badges

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeSystem = "system"
	TypeCustom = "custom"

	GrantModeAuto   = "auto"
	GrantModeManual = "manual"

	IconTypeKey   = "key"
	IconTypeAsset = "asset"
)

Variables

This section is empty.

Functions

func DeleteByCode

func DeleteByCode(code string) error

func Save

func Save(entity *Entity) error

Types

type Entity

type Entity struct {
	Id          uint64    `gorm:"primaryKey;column:id;autoIncrement;not null;" json:"id"`
	Code        string    `gorm:"column:code;type:varchar(64);not null;uniqueIndex;" json:"code"`
	Type        string    `gorm:"column:type;type:varchar(16);not null;default:'custom';index;" json:"type"`
	GrantMode   string    `gorm:"column:grant_mode;type:varchar(16);not null;default:'manual';" json:"grantMode"`
	Name        string    `gorm:"column:name;type:varchar(64);not null;default:'';" json:"name"`
	Description string    `gorm:"column:description;type:varchar(255);not null;default:'';" json:"description"`
	IconType    string    `gorm:"column:icon_type;type:varchar(16);not null;default:'key';" json:"iconType"`
	IconKey     string    `gorm:"column:icon_key;type:varchar(64);not null;default:'';" json:"iconKey"`
	IconURL     string    `gorm:"column:icon_url;type:varchar(255);not null;default:'';" json:"iconUrl"`
	Color       string    `gorm:"column:color;type:varchar(32);not null;default:'';" json:"color"`
	Level       string    `gorm:"column:level;type:varchar(32);not null;default:'';" json:"level"`
	IsEnabled   bool      `gorm:"column:is_enabled;type:boolean;not null;default:true;index;" json:"isEnabled"`
	SortOrder   int       `gorm:"column:sort_order;type:int;not null;default:0;index;" json:"sortOrder"`
	CreatedAt   time.Time `gorm:"column:created_at;index;autoCreateTime;<-:create;" json:"createdAt"`
	UpdatedAt   time.Time `gorm:"column:updated_at;autoUpdateTime;" json:"updatedAt"`
}

func All

func All() (entities []*Entity)

func GetByCode

func GetByCode(code string) (entity Entity)

func GetByCodes

func GetByCodes(codes []string) (entities []*Entity)

func GetEnabledCustom

func GetEnabledCustom() (entities []*Entity)

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