farseer-go / data Goto Github PK
View Code? Open in Web Editor NEWorm
Home Page: https://farseer-go.gitee.io/
License: MIT License
orm
Home Page: https://farseer-go.gitee.io/
License: MIT License
在gorm组件中,支持对PO层的tag进行index定义,以此实现索引的自动维护。
但当组合索引比较多时,此种方式不易阅读和后期的维护。
现增加一种新的方式:
在PO层,定义CreateIndex(),以此实现接口:
type IMigratorIndex interface {
// CreateIndex 创建索引
CreateIndex() map[string][]string
}
示例:
type AccountPO struct {
Id int `gorm:"primaryKey;autoIncrement;comment:账户ID"`
AccountName string `gorm:"size:32;not null;comment:账号名称"`
}
// 创建索引
func (*AccountPO) CreateIndex() map[string][]string {
return map[string][]string{
"idx_name": {"account_name", "id"}
}
}
将在框架启动时,创建索引名称为:idx_name,字段为account_name、id 的组合索引。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.