Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Models = []interface{}{ Author{}, Book{}, }
Collection of all database model structs.
View Source
var UUIDNotFound = uuid.MustParse("00000000-0000-0000-0000-000000000000")
UUID returned when an entity is not found.
Functions ¶
func CreateBook ¶
func DeleteBook ¶
func FindOrCreateAuthor ¶
Find Author by Name, creating if not exists. Accepts a DB conn or trx.
Types ¶
type Author ¶
type Author struct { Base Name string `gorm:"not null;unique" json:"name"` Books []*Book `gorm:"many2many:book_authors;" json:"-"` }
func AllAuthors ¶
func FindAuthor ¶
type Base ¶
type Base struct { ID uuid.UUID `gorm:"type:uuid;primaryKey;default:gen_random_uuid()" json:"id"` CreatedAt time.Time `gorm:"autoCreateTime:milli" json:"created_at,omitempty"` UpdatedAt time.Time `gorm:"autoUpdateTime:milli" json:"updated_at,omitempty"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` }
Define core model fields.
Click to show internal directories.
Click to hide internal directories.