db

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migration

func Migration(sqlDir string, session *dbr.Session) error

func NewMySQL

func NewMySQL(addr string, sqlDir string, migration bool) *dbr.Session

NewMySQL 创建一个MySQL db,[path]db存储路径 [sqlDir]sql脚本目录

func NewRedis

func NewRedis(addr string, password string) *redis.Conn

func NewSqlite

func NewSqlite(filepath string, sqlDir string) *dbr.Session

NewSqlite 创建一个sqlite db,[path]db存储路径 [sqlDir]sql脚本目录

Types

type BaseModel

type BaseModel struct {
	Id        int64
	CreatedAt Time
	UpdatedAt Time
}

type FileDirMigrationSource

type FileDirMigrationSource struct {
	Dir string
}

FileDirMigrationSource 文件目录源 遇到目录进行递归获取

func (FileDirMigrationSource) FindMigrations

func (f FileDirMigrationSource) FindMigrations() ([]*migrate.Migration, error)

FindMigrations FindMigrations

type Time

type Time time.Time

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

func (Time) String

func (t Time) String() string

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) (err error)

Jump to

Keyboard shortcuts

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