models

package
v0.0.0-...-d631339 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseStatusEnumActive   = 1
	BaseStatusEnumDisabled = 2
	BaseStatusEnumDeleted  = 3
)

Variables

This section is empty.

Functions

func AutoMigrate

func AutoMigrate(DBExecutor db.DBExecutor)

func AutoSeed

func AutoSeed(dbExecutor db.DBExecutor)

Types

type BaseModel

type BaseModel struct {
	ID         uint           `gorm:"primaryKey" json:"-"`
	CreatedAt  time.Time      `json:"createdAt"`
	UpdatedAt  time.Time      `json:"-"`
	DeletedAt  *time.Time     `gorm:"index" json:"-"`
	BaseStatus BaseStatusEnum `gorm:"index" default:"0" json:"-"`
}

type BaseStatusEnum

type BaseStatusEnum uint8

func (BaseStatusEnum) String

func (s BaseStatusEnum) String() string

func (BaseStatusEnum) StringText

func (s BaseStatusEnum) StringText() string

type Book

type Book struct {
	BaseModel
	UUID   string `gorm:"size:255;index:,unique" json:"UUID"`
	Name   string `gorm:"size:255" json:"name"`
	Author string `gorm:"size:255" json:"author"`
}

type Customer

type Customer struct {
	BaseModel
	UUID      string `gorm:"size:255;index:,unique" json:"UUID"`
	Email     string `gorm:"size:255;index:,unique" json:"email"`
	FirstName string `gorm:"size:255" json:"firstName"`
	LastName  string `gorm:"size:255" json:"lastName"`
}

type Order

type Order struct {
	BaseModel
	UUID         string          `gorm:"size:255;index,unique" json:"UUID"`
	CustomerUUID string          `gorm:"size:255;" json:"customerUUID"`
	BookUUIDs    StringSliceType `gorm:"type:VARCHAR(255)" json:"bookUUIDs"`
}

type Seed

type Seed struct {
	Name string
	Run  func(*gorm.DB) error
}

type StringSliceType

type StringSliceType []string

func (*StringSliceType) Scan

func (o *StringSliceType) Scan(src any) error

func (StringSliceType) Value

func (o StringSliceType) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL