base

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Models

func Models() []any

func Register

func Register(model ...Model)

Types

type BaseModel

type BaseModel struct {
	ID   uint64            `gorm:"type:int;primaryKey;autoIncrement;column:id" json:"-"`
	UUID datatypes.BinUUID `gorm:"type:varchar(36);unique;column:uuid" json:"uuid"`

	CreatedAt int64 `gorm:"autoCreateTime;column:created_at" json:"created_at"`
	UpdatedAt int64 `gorm:"autoUpdateTime;column:updated_at" json:"updated_at"`
}

func (*BaseModel) BeforeCreate

func (m *BaseModel) BeforeCreate(tx *gorm.DB) (err error)

func (*BaseModel) Defaults

func (m *BaseModel) Defaults() []Model

func (*BaseModel) GetID

func (m *BaseModel) GetID() uint64

type Model

type Model interface {
	TableName() string
	Defaults() []Model
	GetID() uint64
	Unique() (string, string)
}

type StringSlice

type StringSlice = datatypes.JSONSlice[string]

Jump to

Keyboard shortcuts

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