models

package
v3.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FrozenState_False = 0
	FrozenState_Ture  = 1
)
View Source
const (
	INVENTORY_DATA_COLUMN_ID            = "id"
	INVENTORY_DATA_COLUMN_CREATED_AT    = "created_at"
	INVENTORY_DATA_COLUMN_UPDATED_AT    = "updated_at"
	INVENTORY_DATA_COLUMN_IS_FROZEN     = "is_frozen"
	INVENTORY_DATA_COLUMN_NAME          = "name"
	INVENTORY_DATA_COLUMN_SERIAL_NO     = "serial_no"
	INVENTORY_DATA_COLUMN_QUANTITY      = "quantity"
	INVENTORY_DATA_COLUMN_PRICE         = "price"
	INVENTORY_DATA_COLUMN_LOCATION      = "location"
	INVENTORY_DATA_COLUMN_PRODUCT_EXTRA = "product_extra"
)
View Source
const (
	INVENTORY_IN_COLUMN_ID          = "id"
	INVENTORY_IN_COLUMN_CREATED_AT  = "created_at"
	INVENTORY_IN_COLUMN_UPDATED_AT  = "updated_at"
	INVENTORY_IN_COLUMN_IS_DELETED  = "is_deleted"
	INVENTORY_IN_COLUMN_DELETE_TIME = "delete_time"
	INVENTORY_IN_COLUMN_PRODUCT_ID  = "product_id"
	INVENTORY_IN_COLUMN_ORDER_NO    = "order_no"
	INVENTORY_IN_COLUMN_USER_ID     = "user_id"
	INVENTORY_IN_COLUMN_USER_NAME   = "user_name"
	INVENTORY_IN_COLUMN_QUANTITY    = "quantity"
	INVENTORY_IN_COLUMN_WEIGHT      = "weight"
	INVENTORY_IN_COLUMN_REMARK      = "remark"
)
View Source
const (
	INVENTORY_OUT_COLUMN_ID          = "id"
	INVENTORY_OUT_COLUMN_CREATED_AT  = "created_at"
	INVENTORY_OUT_COLUMN_UPDATED_AT  = "updated_at"
	INVENTORY_OUT_COLUMN_IS_DELETED  = "is_deleted"
	INVENTORY_OUT_COLUMN_DELETE_TIME = "delete_time"
	INVENTORY_OUT_COLUMN_PRODUCT_ID  = "product_id"
	INVENTORY_OUT_COLUMN_ORDER_NO    = "order_no"
	INVENTORY_OUT_COLUMN_USER_ID     = "user_id"
	INVENTORY_OUT_COLUMN_USER_NAME   = "user_name"
	INVENTORY_OUT_COLUMN_QUANTITY    = "quantity"
	INVENTORY_OUT_COLUMN_WEIGHT      = "weight"
	INVENTORY_OUT_COLUMN_REMARK      = "remark"
)
View Source
const (
	ROLES_COLUMN_ID         = "id"
	ROLES_COLUMN_CREATED_AT = "created_at"
	ROLES_COLUMN_UPDATED_AT = "updated_at"
	ROLES_COLUMN_NAME       = "name"
)
View Source
const (
	USER_PROFILES_COLUMN_ID         = "id"
	USER_PROFILES_COLUMN_CREATED_AT = "created_at"
	USER_PROFILES_COLUMN_UPDATED_AT = "updated_at"
	USER_PROFILES_COLUMN_USER_ID    = "user_id"
	USER_PROFILES_COLUMN_AVATAR     = "avatar"
	USER_PROFILES_COLUMN_ADDRESS    = "address"
)
View Source
const (
	USER_ROLES_COLUMN_USER_ID = "user_id"
	USER_ROLES_COLUMN_ROLE_ID = "role_id"
)
View Source
const (
	USERS_COLUMN_ID         = "id"
	USERS_COLUMN_CREATED_AT = "created_at"
	USERS_COLUMN_UPDATED_AT = "updated_at"
	USERS_COLUMN_USER_NAME  = "user_name"
	USERS_COLUMN_EMAIL      = "email"
)
View Source
const TableNameInventoryData = "inventory_data" //
View Source
const TableNameInventoryIn = "inventory_in" //
View Source
const TableNameInventoryOut = "inventory_out" //
View Source
const TableNameRoles = "roles" //
View Source
const TableNameUserProfiles = "user_profiles" //
View Source
const TableNameUserRoles = "user_roles" //
View Source
const TableNameUsers = "users" //

Variables

This section is empty.

Functions

func NowTime

func NowTime() time.Time

Types

type BaseModel

type BaseModel struct {
	CreatedAt time.Time `` //创建时间
	/* 138-byte string literal not displayed */
	UpdatedAt time.Time `` //更新时间
	/* 138-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*BaseModel) AfterCreateData

func (do *BaseModel) AfterCreateData(db *sqlca.Engine) error

func (*BaseModel) AfterQueryData

func (do *BaseModel) AfterQueryData(db *sqlca.Engine) error

func (*BaseModel) AfterUpdateData

func (do *BaseModel) AfterUpdateData(db *sqlca.Engine) error

func (*BaseModel) BeforeCreateData

func (do *BaseModel) BeforeCreateData(db *sqlca.Engine) error

func (*BaseModel) BeforeDeleteData

func (do *BaseModel) BeforeDeleteData(db *sqlca.Engine) error

func (*BaseModel) BeforeQueryData

func (do *BaseModel) BeforeQueryData(db *sqlca.Engine) error

func (*BaseModel) BeforeUpdateData

func (do *BaseModel) BeforeUpdateData(db *sqlca.Engine) error

func (BaseModel) IsExist

func (b BaseModel) IsExist() bool

是否为数据库中存在的数据

func (BaseModel) IsNew

func (b BaseModel) IsNew() bool

是否为新的数据

type FrozenState

type FrozenState int

func (FrozenState) String

func (s FrozenState) String() string

type InventoryData

type InventoryData struct {
	BaseModel
	Id       uint64      `json:"id,omitempty" db:"id" gorm:"column:id;primaryKey;autoIncrement;"`                                      //
	IsFrozen FrozenState `json:"is_frozen,omitempty" db:"is_frozen" gorm:"column:is_frozen;type:tinyint(1);default:0;" sqlca:"isnull"` //
	Name     string      `json:"name,omitempty" db:"name" gorm:"column:name;type:varchar(255);comment:产品:名称;不能为空;" sqlca:"isnull"`     //产品:名称;不能为空
	SerialNo string      ``                                                                                                            //产品序列号
	/* 140-byte string literal not displayed */
	Quantity     float64           `json:"quantity,omitempty" db:"quantity" gorm:"column:quantity;type:decimal(16,3);default:0.000;" sqlca:"isnull"` //
	Price        *float64          `json:"price,omitempty" db:"price" gorm:"column:price;type:decimal(16,2);default:0.00;" sqlca:"isnull"`           //
	Location     sqlca.Point       `json:"location,omitempty" db:"location" gorm:"column:location;type:point;" sqlca:"isnull"`                       //
	ProductExtra *ProductExtraData `json:"product_extra,omitempty" db:"product_extra" gorm:"column:product_extra;type:json;" sqlca:"isnull"`         //
}

func (*InventoryData) AfterDeleteData

func (do *InventoryData) AfterDeleteData(db *sqlca.Engine) error

func (InventoryData) GetCreatedAt

func (do InventoryData) GetCreatedAt() time.Time

func (InventoryData) GetId

func (do InventoryData) GetId() uint64

func (InventoryData) GetIsFrozen

func (do InventoryData) GetIsFrozen() FrozenState

func (InventoryData) GetLocation

func (do InventoryData) GetLocation() sqlca.Point

func (InventoryData) GetName

func (do InventoryData) GetName() string

func (InventoryData) GetPrice

func (do InventoryData) GetPrice() *float64

func (InventoryData) GetProductExtra

func (do InventoryData) GetProductExtra() *ProductExtraData

func (InventoryData) GetQuantity

func (do InventoryData) GetQuantity() float64

func (InventoryData) GetSerialNo

func (do InventoryData) GetSerialNo() string

func (InventoryData) GetUpdatedAt

func (do InventoryData) GetUpdatedAt() time.Time

func (*InventoryData) SetCreatedAt

func (do *InventoryData) SetCreatedAt(v time.Time)

func (*InventoryData) SetId

func (do *InventoryData) SetId(v uint64)

func (*InventoryData) SetIsFrozen

func (do *InventoryData) SetIsFrozen(v FrozenState)

func (*InventoryData) SetLocation

func (do *InventoryData) SetLocation(v sqlca.Point)

func (*InventoryData) SetName

func (do *InventoryData) SetName(v string)

func (*InventoryData) SetPrice

func (do *InventoryData) SetPrice(v *float64)

func (*InventoryData) SetProductExtra

func (do *InventoryData) SetProductExtra(v *ProductExtraData)

func (*InventoryData) SetQuantity

func (do *InventoryData) SetQuantity(v float64)

func (*InventoryData) SetSerialNo

func (do *InventoryData) SetSerialNo(v string)

func (*InventoryData) SetUpdatedAt

func (do *InventoryData) SetUpdatedAt(v time.Time)

func (InventoryData) TableName

func (do InventoryData) TableName() string

type InventoryIn

type InventoryIn struct {
	BaseModel
	Id         uint64        `json:"id,omitempty" db:"id" gorm:"column:id;primaryKey;autoIncrement;"`                                                    //
	IsDeleted  int8          `json:"is_deleted,omitempty" db:"is_deleted" gorm:"column:is_deleted;type:tinyint(1);default:0;" sqlca:"isnull"`            //
	DeleteTime time.Time     `json:"delete_time,omitempty" db:"delete_time" gorm:"column:delete_time;type:datetime;" sqlca:"isnull"`                     //
	ProductId  uint64        `json:"product_id,omitempty" db:"product_id" gorm:"column:product_id;type:bigint unsigned;" sqlca:"isnull"`                 //
	OrderNo    string        `json:"order_no,omitempty" db:"order_no" gorm:"column:order_no;type:varchar(64);uniqueIndex:UNIQ_ORDER_NO;" sqlca:"isnull"` //
	UserId     uint64        `json:"user_id,omitempty" db:"user_id" gorm:"column:user_id;type:bigint unsigned;default:0;" sqlca:"isnull"`                //
	UserName   string        `json:"user_name,omitempty" db:"user_name" gorm:"column:user_name;type:varchar(64);" sqlca:"isnull"`                        //
	Quantity   float64       `json:"quantity,omitempty" db:"quantity" gorm:"column:quantity;type:decimal(16,6);default:0.000000;" sqlca:"isnull"`        //
	Weight     sqlca.Decimal `json:"weight,omitempty" db:"weight" gorm:"column:weight;type:decimal(16,6);default:0.000000;" sqlca:"isnull"`              //
	Remark     string        `json:"remark,omitempty" db:"remark" gorm:"column:remark;type:varchar(512);" sqlca:"isnull"`                                //
}

func (InventoryIn) GetCreatedAt

func (do InventoryIn) GetCreatedAt() time.Time

func (InventoryIn) GetDeleteTime

func (do InventoryIn) GetDeleteTime() time.Time

func (InventoryIn) GetId

func (do InventoryIn) GetId() uint64

func (InventoryIn) GetIsDeleted

func (do InventoryIn) GetIsDeleted() int8

func (InventoryIn) GetOrderNo

func (do InventoryIn) GetOrderNo() string

func (InventoryIn) GetProductId

func (do InventoryIn) GetProductId() uint64

func (InventoryIn) GetQuantity

func (do InventoryIn) GetQuantity() float64

func (InventoryIn) GetRemark

func (do InventoryIn) GetRemark() string

func (InventoryIn) GetUpdatedAt

func (do InventoryIn) GetUpdatedAt() time.Time

func (InventoryIn) GetUserId

func (do InventoryIn) GetUserId() uint64

func (InventoryIn) GetUserName

func (do InventoryIn) GetUserName() string

func (InventoryIn) GetWeight

func (do InventoryIn) GetWeight() sqlca.Decimal

func (*InventoryIn) SetCreatedAt

func (do *InventoryIn) SetCreatedAt(v time.Time)

func (*InventoryIn) SetDeleteTime

func (do *InventoryIn) SetDeleteTime(v time.Time)

func (*InventoryIn) SetId

func (do *InventoryIn) SetId(v uint64)

func (*InventoryIn) SetIsDeleted

func (do *InventoryIn) SetIsDeleted(v int8)

func (*InventoryIn) SetOrderNo

func (do *InventoryIn) SetOrderNo(v string)

func (*InventoryIn) SetProductId

func (do *InventoryIn) SetProductId(v uint64)

func (*InventoryIn) SetQuantity

func (do *InventoryIn) SetQuantity(v float64)

func (*InventoryIn) SetRemark

func (do *InventoryIn) SetRemark(v string)

func (*InventoryIn) SetUpdatedAt

func (do *InventoryIn) SetUpdatedAt(v time.Time)

func (*InventoryIn) SetUserId

func (do *InventoryIn) SetUserId(v uint64)

func (*InventoryIn) SetUserName

func (do *InventoryIn) SetUserName(v string)

func (*InventoryIn) SetWeight

func (do *InventoryIn) SetWeight(v sqlca.Decimal)

func (InventoryIn) TableName

func (do InventoryIn) TableName() string

type InventoryOut

type InventoryOut struct {
	BaseModel
	Id         uint64    `json:"id,omitempty" db:"id" gorm:"column:id;primaryKey;autoIncrement;"`                                         //
	IsDeleted  int8      `json:"is_deleted,omitempty" db:"is_deleted" gorm:"column:is_deleted;type:tinyint(1);default:0;" sqlca:"isnull"` //
	DeleteTime time.Time `json:"delete_time,omitempty" db:"delete_time" gorm:"column:delete_time;type:datetime;" sqlca:"isnull"`          //
	ProductId  uint64    ``                                                                                                               //
	/* 161-byte string literal not displayed */
	OrderNo string `json:"order_no,omitempty" db:"order_no" gorm:"column:order_no;type:varchar(64);uniqueIndex:UNIQ_ORDER_NO;" sqlca:"isnull"` //
	UserId  uint64 ``                                                                                                                          //
	/* 149-byte string literal not displayed */
	UserName string        `json:"user_name,omitempty" db:"user_name" gorm:"column:user_name;type:varchar(64);index:FULTXT_user_name;" sqlca:"isnull"` //
	Quantity float64       `json:"quantity,omitempty" db:"quantity" gorm:"column:quantity;type:decimal(16,6);default:0.000000;" sqlca:"isnull"`        //
	Weight   sqlca.Decimal `json:"weight,omitempty" db:"weight" gorm:"column:weight;type:decimal(16,6);default:0.000000;" sqlca:"isnull"`              //
	Remark   string        `json:"remark,omitempty" db:"remark" gorm:"column:remark;type:varchar(512);" sqlca:"isnull"`                                //
}

func (InventoryOut) GetCreatedAt

func (do InventoryOut) GetCreatedAt() time.Time

func (InventoryOut) GetDeleteTime

func (do InventoryOut) GetDeleteTime() time.Time

func (InventoryOut) GetId

func (do InventoryOut) GetId() uint64

func (InventoryOut) GetIsDeleted

func (do InventoryOut) GetIsDeleted() int8

func (InventoryOut) GetOrderNo

func (do InventoryOut) GetOrderNo() string

func (InventoryOut) GetProductId

func (do InventoryOut) GetProductId() uint64

func (InventoryOut) GetQuantity

func (do InventoryOut) GetQuantity() float64

func (InventoryOut) GetRemark

func (do InventoryOut) GetRemark() string

func (InventoryOut) GetUpdatedAt

func (do InventoryOut) GetUpdatedAt() time.Time

func (InventoryOut) GetUserId

func (do InventoryOut) GetUserId() uint64

func (InventoryOut) GetUserName

func (do InventoryOut) GetUserName() string

func (InventoryOut) GetWeight

func (do InventoryOut) GetWeight() sqlca.Decimal

func (*InventoryOut) SetCreatedAt

func (do *InventoryOut) SetCreatedAt(v time.Time)

func (*InventoryOut) SetDeleteTime

func (do *InventoryOut) SetDeleteTime(v time.Time)

func (*InventoryOut) SetId

func (do *InventoryOut) SetId(v uint64)

func (*InventoryOut) SetIsDeleted

func (do *InventoryOut) SetIsDeleted(v int8)

func (*InventoryOut) SetOrderNo

func (do *InventoryOut) SetOrderNo(v string)

func (*InventoryOut) SetProductId

func (do *InventoryOut) SetProductId(v uint64)

func (*InventoryOut) SetQuantity

func (do *InventoryOut) SetQuantity(v float64)

func (*InventoryOut) SetRemark

func (do *InventoryOut) SetRemark(v string)

func (*InventoryOut) SetUpdatedAt

func (do *InventoryOut) SetUpdatedAt(v time.Time)

func (*InventoryOut) SetUserId

func (do *InventoryOut) SetUserId(v uint64)

func (*InventoryOut) SetUserName

func (do *InventoryOut) SetUserName(v string)

func (*InventoryOut) SetWeight

func (do *InventoryOut) SetWeight(v sqlca.Decimal)

func (InventoryOut) TableName

func (do InventoryOut) TableName() string

type ProductExtraData

type ProductExtraData struct {
	AvgPrice   sqlca.Decimal `json:"avg_price"`   //均价
	SpecsValue string        `json:"specs_value"` //规格
}

type Role

type Role struct {
	BaseModel
	Id   uint64 `json:"id,omitempty" db:"id" gorm:"column:id;primaryKey;autoIncrement;"`                                         //
	Name string `json:"name,omitempty" db:"name" gorm:"column:name;type:varchar(64);uniqueIndex:idx_roles_name;" sqlca:"isnull"` //
}

func (Role) GetCreatedAt

func (do Role) GetCreatedAt() time.Time

func (Role) GetId

func (do Role) GetId() uint64

func (Role) GetName

func (do Role) GetName() string

func (Role) GetUpdatedAt

func (do Role) GetUpdatedAt() time.Time

func (*Role) SetCreatedAt

func (do *Role) SetCreatedAt(v time.Time)

func (*Role) SetId

func (do *Role) SetId(v uint64)

func (*Role) SetName

func (do *Role) SetName(v string)

func (*Role) SetUpdatedAt

func (do *Role) SetUpdatedAt(v time.Time)

func (Role) TableName

func (do Role) TableName() string

type User

type User struct {
	BaseModel
	Id       uint64 `json:"id,omitempty" db:"id" gorm:"column:id;primaryKey;autoIncrement;"` //
	UserName string ``                                                                       //
	/* 130-byte string literal not displayed */
	Email   string      `json:"email,omitempty" db:"email" gorm:"column:email;type:varchar(64);uniqueIndex:idx_users_email;" sqlca:"isnull"` //
	Roles   []*Role     `json:"roles,omitempty" db:"-" gorm:"many2many:user_roles;"`                                                         // 用户角色列表
	Profile UserProfile `json:"profile,omitempty" db:"-" gorm:"foreignKey:UserId;"`                                                          // 用户资料明细
}

func (*User) AfterQueryData

func (do *User) AfterQueryData(db *sqlca.Engine, ok bool) error

func (User) GetCreatedAt

func (do User) GetCreatedAt() time.Time

func (User) GetEmail

func (do User) GetEmail() string

func (User) GetId

func (do User) GetId() uint64

func (User) GetUpdatedAt

func (do User) GetUpdatedAt() time.Time

func (User) GetUserName

func (do User) GetUserName() string

func (*User) SetCreatedAt

func (do *User) SetCreatedAt(v time.Time)

func (*User) SetEmail

func (do *User) SetEmail(v string)

func (*User) SetId

func (do *User) SetId(v uint64)

func (*User) SetUpdatedAt

func (do *User) SetUpdatedAt(v time.Time)

func (*User) SetUserName

func (do *User) SetUserName(v string)

func (User) TableName

func (do User) TableName() string

type UserProfile

type UserProfile struct {
	BaseModel
	Id     uint64 `json:"id,omitempty" db:"id" gorm:"column:id;primaryKey;autoIncrement;"` //
	UserId uint64 ``                                                                       //
	/* 134-byte string literal not displayed */
	Avatar  string `json:"avatar,omitempty" db:"avatar" gorm:"column:avatar;type:varchar(512);" sqlca:"isnull"`    //
	Address string `json:"address,omitempty" db:"address" gorm:"column:address;type:varchar(128);" sqlca:"isnull"` //
}

func (UserProfile) GetAddress

func (do UserProfile) GetAddress() string

func (UserProfile) GetAvatar

func (do UserProfile) GetAvatar() string

func (UserProfile) GetCreatedAt

func (do UserProfile) GetCreatedAt() time.Time

func (UserProfile) GetId

func (do UserProfile) GetId() uint64

func (UserProfile) GetUpdatedAt

func (do UserProfile) GetUpdatedAt() time.Time

func (UserProfile) GetUserId

func (do UserProfile) GetUserId() uint64

func (*UserProfile) SetAddress

func (do *UserProfile) SetAddress(v string)

func (*UserProfile) SetAvatar

func (do *UserProfile) SetAvatar(v string)

func (*UserProfile) SetCreatedAt

func (do *UserProfile) SetCreatedAt(v time.Time)

func (*UserProfile) SetId

func (do *UserProfile) SetId(v uint64)

func (*UserProfile) SetUpdatedAt

func (do *UserProfile) SetUpdatedAt(v time.Time)

func (*UserProfile) SetUserId

func (do *UserProfile) SetUserId(v uint64)

func (UserProfile) TableName

func (do UserProfile) TableName() string

type UserRole

type UserRole struct {
	UserId uint64 `json:"user_id,omitempty" db:"user_id" gorm:"column:user_id;type:bigint unsigned;uniqueIndex:PRIMARY;"` //
	RoleId uint64 ``                                                                                                      //
	/* 126-byte string literal not displayed */
}

func (UserRole) GetRoleId

func (do UserRole) GetRoleId() uint64

func (UserRole) GetUserId

func (do UserRole) GetUserId() uint64

func (*UserRole) SetRoleId

func (do *UserRole) SetRoleId(v uint64)

func (*UserRole) SetUserId

func (do *UserRole) SetUserId(v uint64)

func (UserRole) TableName

func (do UserRole) TableName() string

Jump to

Keyboard shortcuts

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