articleCategory

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: May 22, 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 MathAbs added in v0.1.1

func MathAbs(v float64) float64

func SaveAll

func SaveAll(entities *[]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"`                //
	Category  string    `gorm:"column:category;type:varchar(64);not null;default:'';" json:"category"` //
	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"`        //
	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 any) (entity Entity)

func GetOne added in v0.0.4

func GetOne() (entity Entity)

func (*Entity) AfterFind added in v0.1.1

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

func (*Entity) BeforeSave added in v0.1.1

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

func (*Entity) CalculateColor added in v0.1.1

func (itself *Entity) CalculateColor() string

CalculateColor 根据分类名称计算一个固定的 HSL 颜色,返回 Hex 格式

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