storage

package
v3.1.0-rc.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2018 License: MIT Imports: 0 Imported by: 0

README

storage contoller

Documentation

Index

Constants

View Source
const (
	INDEX_TYPE_UNIQUE           = 1 //唯一索引
	INDEX_TYPE_PRIMAEY          = 2 //主键
	INDEX_TYPE_GENERAL          = 3 // 普通索引
	INDEX_TYPE_BACKGROUP_UNIQUE = 4 //mogon特殊,唯一,且后台生产索引
	INDEX_TYPE_BACKGROUP        = 5 //mogon特殊,后台生产索引
)
View Source
const (
	DI_MYSQL string = "mysql"
	DI_MONGO string = "mongodb"
	DI_REDIS string = "redis"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Name string
	Ext  interface{}
}

func GetMongoColumn

func GetMongoColumn(name string, val interface{}) *Column

type DI

type DI interface {
	GetIncID(cName string) (int64, error)
	Insert(cName string, data interface{}) (int, error)
	InsertMuti(cName string, data ...interface{}) error
	IsDuplicateErr(err error) bool
	IsNotFoundErr(err error) bool
	UpdateByCondition(cName string, data, condition interface{}) error
	GetOneByCondition(cName string, fields []string, condition interface{}, result interface{}) error
	GetMutilByCondition(cName string, fields []string, condition interface{}, result interface{}, sort string, start, limit int) error
	GetCntByCondition(cName string, condition interface{}) (int, error)
	DelByCondition(cName string, condition interface{}) error
	HasTable(cName string) (bool, error)
	ExecSql(cmd interface{}) error
	Index(cName string, index *Index) error
	DropTable(cName string) error
	HasFields(cName, field string) (bool, error)
	AddColumn(cName string, column *Column) error
	ModifyColumn(cName, oldName, newColumn string) error
	DropColumn(cName, field string) error
	CreateTable(sql string) error
	GetType() string
	Open() error
	Ping() error
	Close()
	GetSession() interface{}
	GetDBName() string
}

DI define storage interface

type Index

type Index struct {
	Name    string
	Columns []string
	Type    int
}

func GetMongoIndex

func GetMongoIndex(name string, keys []string, unique, background bool) *Index

type M

type M map[string]interface{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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