version

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Core

type Core struct {
	IsMigrate *bool
	// contains filtered or unexported fields
}

Core 控制程序启动时是否执行表迁移 每次都执行启动太慢了

func NewCore

func NewCore(store Storer) Core

NewCore ...

func (Core) IsAutoMigrate

func (c Core) IsAutoMigrate(currentVer string) bool

IsAutoMigrate 是否需要进行表迁移?

func (Core) RecordVersion

func (c Core) RecordVersion(currentVer, remark string) error

RecordVersion 记录当前版本号

type Storer

type Storer interface {
	First(*Version) error
	Add(*Version) error
}

Storer ...

type Version

type Version struct {
	orm.Model
	Version string // 版本
	Remark  string // 迁移说明
}

Version 数据库版本记录 每次迁移,则创建一条记录 每次程序启动,则按 id 倒序获取最后一条记录,当小于硬编码的版本号时,进行数据库迁移

func (*Version) TableName

func (*Version) TableName() string

TableName ...

Directories

Path Synopsis
store

Jump to

Keyboard shortcuts

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