Documentation ¶
Index ¶
Constants ¶
View Source
const ( // ErrNotFound is returned when a resource cannot be found in the database. ErrNotFound modelError = "models: resource not found" ErrTextRequired modelError = "models: text is required" // ErrIDInvalid is returned when an invalid ID is provided to a method like Update. ErrIDInvalid privateError = "models: ID provided was invalid" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Services ¶
type Services struct { Table TableService // contains filtered or unexported fields }
func NewServices ¶
func NewServices(cfgs ...ServicesConfig) (*Services, error)
func (*Services) AutoMigrate ¶
AutoMigrate will attempt to automatically migrate all tables.
type ServicesConfig ¶
func WithGORM ¶
func WithGORM(dsn string) ServicesConfig
func WithGORMLogMode ¶
func WithGORMLogMode(dsn string, mode bool) ServicesConfig
func WithTable ¶
func WithTable() ServicesConfig
type Table ¶
type Table struct { ID uuid.UUID `gorm:"type:uuid;not null;primaryKey"` Text string `gorm:"column:text;type:varchar;size:255"` CodeID uuid.UUID `gorm:"column:code_id;type:uuid;not null"` Code uint `gorm:"column:code;type:smallint"` Name string `gorm:"column:name;type:varchar;size:255"` }
Table base model of data represented in DB.
type TableService ¶
type TableService interface { TableDB }
func NewTableService ¶
func NewTableService(db *gorm.DB) TableService
Click to show internal directories.
Click to hide internal directories.