model

package
v0.3.12 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateData

func CreateData(ctx context.Context, t *Data) *gorm.DB

func DeleteData

func DeleteData(ctx context.Context, id int64) *gorm.DB

Types

type Account

type Account struct {
	ID        uint64     `gorm:"->;column:id;primaryKey;type:INT;autoIncrement" json:"id"`
	Name      string     `gorm:";column:name;type:VARCHAR(100);not null;comment:名字" json:"name"`
	PublicKey string     `gorm:";column:publicKey;type:VARCHAR(100);not null;comment:用户公钥base64格式" json:"publicKey"`
	CreatedAt time.Time  `gorm:"->;column:createdAt;not null;type:DATETIME(6);default:CURRENT_TIMESTAMP(6)" json:"-"`
	UpdatedAt time.Time  `gorm:"->;column:updatedAt;not null;type:DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6);default:CURRENT_TIMESTAMP(6)" json:"-"`
	DeletedAt *time.Time `gorm:"->;column:deletedAt;type:DATETIME(6);default:NULL" json:"-"`
}

func GetAccountByID

func GetAccountByID(ctx context.Context, id int64) *Account

func ImportAccount

func ImportAccount(ctx context.Context, name, publicKey string) *Account

func (Account) TableName

func (Account) TableName() string

type Data

type Data struct {
	ID        int64      `gorm:"->;column:id;primaryKey;type:INT;autoIncrement" json:"id"`
	AccountId int64      `gorm:"column:accountId;type:INT" json:"accountId"`
	Name      string     `gorm:"column:name;type:VARCHAR(100);not null" json:"name"`
	Data      string     `gorm:"column:data;type:TEXT(65535)" json:"data"`
	CreatedAt time.Time  `gorm:"->;column:createdAt;not null;type:DATETIME(6);default:CURRENT_TIMESTAMP(6)" json:"createdAt"`
	UpdatedAt time.Time  `gorm:"->;column:updatedAt;not null;type:DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6);default:CURRENT_TIMESTAMP(6)" json:"-"`
	DeletedAt *time.Time `gorm:"column:deletedAt;type:DATETIME(6);default:NULL" json:"-"`
}

func GetData

func GetData(ctx context.Context, accountId int64, name string) (*Data, error)

func (Data) TableName

func (Data) TableName() string

Source Files

  • account.go
  • data.go

Jump to

Keyboard shortcuts

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