models

package
v0.26.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DropDB

func DropDB() error

DropDB 删除Demo插件相关的表及数据 通过GORM Migrator执行删除操作,兼容多种数据库

func InitDB

func InitDB() error

InitDB 初始化数据库表(GORM自动迁移)

func UpgradeDB

func UpgradeDB(fromVersion string, toVersion string) error

UpgradeDB 升级Demo插件数据库结构与数据 根据版本进行安全迁移,确保表结构与最新模型一致

Types

type Item

type Item struct {
	ID          uint      `gorm:"primaryKey;autoIncrement" json:"id"`
	Name        string    `gorm:"size:255;not null" json:"name"`
	Description string    `gorm:"type:text" json:"description"`
	CreatedAt   time.Time `json:"created_at,omitempty" gorm:"<-:create"`
	UpdatedAt   time.Time `json:"updated_at,omitempty"`
	CreatedBy   string    `json:"created_by,omitempty" gorm:"size:255"`
}

Item 演示数据模型(使用数据库存储)

func (Item) TableName

func (Item) TableName() string

TableName 使用插件名前缀

Jump to

Keyboard shortcuts

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