Documentation ¶
Index ¶
- Constants
- Variables
- func Direct(val reflect.Value) reflect.Value
- func IsFunc(val string) bool
- func IsZero(val reflect.Value) bool
- func Register(name string, opener Opener)
- func SplitFuncArgs(val string) (string, []string)
- func UnescapeDefault(val string) string
- type Capability
- type Conn
- type Driver
- type Fields
- type Iter
- type Join
- type JoinType
- type Methods
- type Model
- type Opener
- type Reference
- type Result
- type Sort
- type SortDirection
- type Tx
Constants ¶
View Source
const ( // No capabilities CAP_NONE Capability = 0 // Can perform JOINs CAP_JOIN = 1 << iota // Can perform OR queries CAP_OR // Can create transactions CAP_TRANSACTION // Can begin/commit/rollback a transaction CAP_BEGIN // Can automatically assign ids to rows CAP_AUTO_ID // Automatically assigned ids increase sequentially CAP_AUTO_INCREMENT // Provides eventual consistency rather than strong consistency CAP_EVENTUAL // Supports having a primary key CAP_PK // Primary key can be formed from multiple fields CAP_COMPOSITE_PK // Can have non-PK unique fields, enforce by the backend. CAP_UNIQUE // Can have database level defaults. CAP_DEFAULTS // Can have database level defaults for TEXT fields (unbounded strings). CAP_DEFAULTS_TEXT )
Variables ¶
Functions ¶
func Direct ¶
Direct descends into val.Elem() as long as val.Type().Kind() is reflect.Ptr and returns the result.
func SplitFuncArgs ¶
func UnescapeDefault ¶
Types ¶
type Conn ¶
type Conn interface { Query(m Model, q query.Q, sort []Sort, limit int, offset int) Iter Count(m Model, q query.Q, limit int, offset int) (uint64, error) Exists(m Model, q query.Q) (bool, error) Insert(m Model, data interface{}) (Result, error) Operate(m Model, q query.Q, ops []*operation.Operation) (Result, error) Update(m Model, q query.Q, data interface{}) (Result, error) Upsert(m Model, q query.Q, data interface{}) (Result, error) Delete(m Model, q query.Q) (Result, error) Connection() interface{} }
type Driver ¶
type Driver interface { Conn Check() error Initialize(m []Model) error Begin() (Tx, error) Transaction(f func(Driver) error) error Close() error // True if the driver can perform upserts Upserts() bool // List of struct tags to be read, in decreasing order of priority. // The first non-empty tag is used. Tags() []string Capabilities() Capability HasFunc(fname string, retType reflect.Type) bool }
type Fields ¶
type Fields struct { *structs.Struct // Quoted mangled names of the fields, including the table // name (e.g. "table"."field"). QuotedNames []string // Fields which should be omitted when they are empty OmitEmpty []bool // Fields which should become null when they are empty NullEmpty []bool // The index of the primary (-1 if there's no pk) PrimaryKey int // True if the primary key is an integer type with auto_increment AutoincrementPk bool // The fields which make the composite primary key, if any CompositePrimaryKey []int // Model methods called by the ORM Methods *Methods // Other models referenced by this model. The key // is the field name in this model. References map[string]*Reference // Default values. Key is field index, value is the default // which might be a reflect.Func with no arguments and one // return value or simply a value assignable to the field. Defaults map[int]reflect.Value }
func (*Fields) DefaultValue ¶
func (*Fields) HasDefault ¶
func (*Fields) IsSubfield ¶
type Methods ¶
type Methods struct { // The address for the Load method. 0 if there's no Load method LoadPointer unsafe.Pointer // Wheter Load returns an error LoadReturns bool // The address for the Save method. 0 if there's no Save method SavePointer unsafe.Pointer // Wheter Save returns an error SaveReturns bool }
type Sort ¶
type Sort interface { Field() string Direction() SortDirection }
type SortDirection ¶
type SortDirection int
const ( // These constants are documented in the gnd.la/orm package DESC SortDirection = -1 ASC = 1 )
Source Files ¶
Click to show internal directories.
Click to hide internal directories.