some fix / add test

This commit is contained in:
slene
2013-08-07 19:11:44 +08:00
parent 10f4e822c3
commit 46668b811f
15 changed files with 1082 additions and 222 deletions

View File

@@ -32,32 +32,8 @@ func (f *fieldChoices) Clone() fieldChoices {
return *f
}
type primaryKeys []*fieldInfo
func (p *primaryKeys) Add(fi *fieldInfo) {
*p = append(*p, fi)
}
func (p primaryKeys) Exist(fi *fieldInfo) (int, bool) {
for i, v := range p {
if v == fi {
return i, true
}
}
return -1, false
}
func (p primaryKeys) IsMulti() bool {
return len(p) > 1
}
func (p primaryKeys) IsEmpty() bool {
return len(p) == 0
}
type fields struct {
pk primaryKeys
auto *fieldInfo
pk *fieldInfo
columns map[string]*fieldInfo
fields map[string]*fieldInfo
fieldsLow map[string]*fieldInfo