optRecord

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(entity *Entity) int64

func Page

func Page(q PageQuery) struct {
	Page     int
	PageSize int
	Total    int64
	Data     []Entity
}

func SaveOrCreateById

func SaveOrCreateById(entity *Entity) int64

Types

type Entity

type Entity struct {
	Id         uint64    `gorm:"primaryKey;column:id;autoIncrement;not null;" json:"id"`                       //
	OptUserId  uint64    `gorm:"column:opt_user_id;type:bigint unsigned;not null;default:0;" json:"optUserId"` //
	OptType    int       `gorm:"column:opt_type;type:int;not null;default:0;" json:"optType"`                  //
	TargetType int       `gorm:"column:target_type;type:int;not null;default:0;" json:"targetType"`            //
	TargetId   string    `gorm:"column:target_id;type:varchar(255);not null;default:'';" json:"targetId"`      //
	OptInfo    string    `gorm:"column:opt_info;type:text;" json:"optInfo"`                                    //
	CreatedAt  time.Time `gorm:"column:created_at;index;autoCreateTime;" json:"createdAt"`                     //
}

func Get

func Get(id any) (entity Entity)

func (*Entity) TableName

func (itself *Entity) TableName() string

type PageQuery

type PageQuery struct {
	Page, PageSize int
	OptUserId      uint64
	OptType        int
	TargetType     int
	TargetId       int
}

Jump to

Keyboard shortcuts

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