first commit

This commit is contained in:
Akhil Gupta
2021-05-29 15:20:50 +05:30
commit d25c30a7b2
194 changed files with 49873 additions and 0 deletions

22
server/db/base.go Normal file
View File

@@ -0,0 +1,22 @@
package db
import (
"time"
uuid "github.com/satori/go.uuid"
"gorm.io/gorm"
)
//Base is
type Base struct {
ID string `sql:"type:uuid;primary_key" json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt *time.Time `gorm:"index" json:"deletedAt"`
}
//BeforeCreate
func (base *Base) BeforeCreate(tx *gorm.DB) error {
tx.Statement.SetColumn("ID", uuid.NewV4().String())
return nil
}