forked from rainycape/gondola
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
34 lines (32 loc) · 1.19 KB
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package orm
import (
"gnd.la/orm/index"
)
// Options are the structure used to specify
// further options when registing a model.
type Options struct {
// The name to use when creating for the table
// or collection. If no name is provided, it will
// be derived from the package and type name.
// Type Baz in package foo/bar will be named
// foo_bar_baz, but types in the main package will
// omit the package name (e.g. Foo becomes foo,
// not main_foo).
Table string
// Name is the model name which is going to be registered
// by default, it's the type name in its package. The
// model name is used when specifying relations and when
// disambiguating field names.
Name string
// Any indexes that can't be declared using field tags
// (most of the time because they index multiple fields
// or require special flags).
Indexes []*index.Index
// The primary key when it's not specified in struct tags
// or when it's a composite key. The names of the fields
// must be qualified names (i.e. the name of the field
// in the Go struct). If the primary key is
// defined in both the a field tag and using this field, an
// error will be returned when registering the model.
PrimaryKey []string
}