category

package
v0.2.49 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count

func Count() int64

func DeleteEntity

func DeleteEntity(entity *Entity) int64

func SaveOrCreateById

func SaveOrCreateById(entity *Entity) int64

Types

type Entity

type Entity struct {
	Id        uint64    `gorm:"primaryKey;column:id;autoIncrement;not null;" json:"id"`
	Name      string    `gorm:"column:name;type:varchar(64);not null;default:'';" json:"name"`
	Desc      string    `gorm:"column:desc;type:varchar(255);not null;default:'';" json:"desc"`
	Icon      string    `gorm:"column:icon;type:varchar(255);not null;default:'';" json:"icon"`
	Color     string    `gorm:"column:color;type:varchar(255);not null;default:'';" json:"color"`
	Slug      string    `gorm:"column:slug;type:varchar(255);not null;default:'';" json:"slug"`
	Sort      int       `gorm:"column:sort;type:int;not null;default:0;index:idx_category_sort,priority:1;" json:"sort"`
	CreatedAt time.Time `gorm:"column:created_at;autoCreateTime;<-:create;" json:"createdAt"`
	UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime;" json:"updatedAt"`
}

func All

func All() (entities []*Entity)

func Get

func Get(id uint64) (entity Entity)

func (*Entity) AfterFind

func (itself *Entity) AfterFind(tx *gorm.DB) (err error)

func (*Entity) BeforeSave

func (itself *Entity) BeforeSave(tx *gorm.DB) (err error)

func (*Entity) CalculateColor

func (itself *Entity) CalculateColor() string

func (*Entity) TableName

func (itself *Entity) TableName() string

Jump to

Keyboard shortcuts

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