model

package
v0.0.0-...-bbd874b Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Db *gorm.DB

Functions

func AutoMigrateDb

func AutoMigrateDb(cfg *Configuration) error

func CreateDb

func CreateDb(cfg *Configuration) error

创建db

func DropDb

func DropDb(cfg *Configuration) error

删除db

func GetDbConfig

func GetDbConfig(cfg *Configuration) *gorm.DB

得到当前的db信息

func InitCurrDb

func InitCurrDb(cfg *Configuration) *gorm.DB

Types

type Configuration

type Configuration struct {
	// 环境
	Env string `json:"env"`
	// mysql host
	Host string `json:"host"`
	// mysql 密码
	Password string `json:"password"`
	// mysql 用户名
	UserName string `json:"user_name"`
	// mysql 数据库前缀
	Prefix string `json:"prefix"`
	// mysql 数据库名称
	Name string `json:"name"`
	// mysql dialect
	Type string `json:"type"`
	// 最大空闲连接数量
	MaxIdleConn int `json:"max_idle_conn"`
	//
	MaxOpenConn int `json:"max_open_conn"`
	// port
	Port int `json:"port"`
}

type UserInfo

type UserInfo struct {
	gorm.Model
	UserName string `json:"user_name"`
	UserId   string `json:"user_id"`
}

func (*UserInfo) CreateUser

func (u *UserInfo) CreateUser(req *server_model.AddUpdateUser) error

新增用户

Jump to

Keyboard shortcuts

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