Documentation ¶
Overview ¶
@Time : 2018/8/15 19:05 @Author : kenny zhu @File : base.go @Software: GoLand @Others: model base operation @refer:github.com/go-tango/wego/blob/master/models/base.go.
@Time : 2018/8/15 19:05 @Author : kennyzhu @File : base.go @Software: GoLand @Others: create by xorm reverse mysql command.
@Time : 2018/8/16 9:55 @Author : kenny zhu @File : tables.go @Software: GoLand @Others: Sharding tables' operations
Index ¶
- Variables
- func CreateIndexes(createIndexesSql string) error
- func CreateTables(createTablesSql string) error
- func Find(limit, start int, objs interface{}) error
- func GetById(id int64, obj interface{}) error
- func Init(isProMode bool, logPath string)
- func IsExist(obj interface{}) bool
- func ORM() *xorm.Engine
- func ShardFind(id int64, limit, start int, objs interface{}) error
- func ShardGetById(id int64, obj interface{}) error
- func ShardGetTable(tableNameOrBean interface{}, suffixKey int64) *xorm.Session
- func ShardIsExist(id int64, obj interface{}) bool
- func SyncAllTables() error
- type ModelFinder
- type Preferences
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotExist = errors.New("not exist")
)
Functions ¶
func CreateTables ¶
add other ops for all models.. Create tables for QReader, this will drop them first, you may lost data if the tables are already exists.
func ShardGetById ¶
engine.Table("user").Select("user.*, detail.*").
Join("INNER", "detail", "detail.user_id = user.id"). Where("user.name = ?", name).Limit(10, 0). Find(&users)
Get object by primary key id
func ShardGetTable ¶
Types ¶
type ModelFinder ¶
type ModelFinder interface {
Object() interface{}
}
type Preferences ¶
type Preferences struct { User int `xorm:"not null pk autoincr INT(10)"` Name string `xorm:"not null VARCHAR(32)"` Value string `xorm:"not null VARCHAR(64)"` }
func (*Preferences) String ¶
func (m *Preferences) String() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.