model

package
v0.0.0-...-678b904 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCallFail = errors.New(NAME + ": transfer funcs fail.")

ErrCallFail 调用失败

View Source
var ErrorLinkFail = errors.New(NAME + ": Link failed error.")

ErrorLinkFail 数据库链接失败

View Source
var ModelPool map[string]IModel = make(map[string]IModel)

ModelPool 存放服务的数据库rpc服务 模型池 根据控制器的名称存放

View Source
var NAME = "Model"

NAME 名称

Functions

func PoolAdd

func PoolAdd(key string, model IModel)

PoolAdd ...

func PoolRun

func PoolRun()

PoolRun 初始化池模型

func RandPWD

func RandPWD(number int) string

RandPWD 随机密码生成 number 生成多少位

func TableSize

func TableSize(con *gorm.DB, tableName string) int

TableSize ... 获取表长度

Types

type IModel

type IModel interface {
	Init()                                                  // 初始化
	Go(key interface{}, args []interface{}) *chanrpc.Result // 调用模型方法
}

IModel 服务结构

type Model

type Model struct {
	Server *chanrpc.Server
	Db     *gorm.DB
}

Model ...

func NewModel

func NewModel() *Model

NewModel ... 创建模型

func (*Model) GetDb

func (m *Model) GetDb() (*gorm.DB, error)

GetDb 获取数据库链接

Jump to

Keyboard shortcuts

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