Documentation
¶
Index ¶
- type Attribute
- type Authenticator
- type BaseFilter
- type Context
- type Database
- type ErrorSet
- type Filter
- type Include
- type Instance
- type InstancePointer
- func (ip InstancePointer) Equal(oip InstancePointer) bool
- func (ip *InstancePointer) GetID() string
- func (ip *InstancePointer) GetType() string
- func (v InstancePointer) MarshalEasyJSON(w *jwriter.Writer)
- func (ip *InstancePointer) SetID(id string)
- func (v *InstancePointer) UnmarshalEasyJSON(l *jlexer.Lexer)
- type Manager
- type ManagerStub
- func (stub ManagerStub) BeforeCreate(c Context, values map[string]interface{}) error
- func (stub ManagerStub) BeforeSave(c Context, values map[string]interface{}) error
- func (stub ManagerStub) BeforeUpdate(c Context, oldValues map[string]interface{}, newValues map[string]interface{}) error
- func (stub ManagerStub) GetFilterForUser(user User, nextArg int) ([]string, []interface{})
- type Model
- type Page
- type Query
- type Relationship
- type Result
- type Server
- type Transaction
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
type Attribute interface {
GetKey() string
GetSelectDirect() ([]string, []interface{})
GetOrderMap() map[string]string
AvailableFilters() []interface{}
ValidateFilters(map[string][]string) ([]Filter, error)
GetFilterWhere(int, map[string][]string) ([]string, []interface{})
DefaultFallback(interface{}, interface{}) (interface{}, error)
Validate(interface{}) (interface{}, error)
ValidateUpdate(interface{}, interface{}) (interface{}, error)
GetInsert(interface{}) ([]string, []interface{})
}
type Authenticator ¶
type BaseFilter ¶
func (BaseFilter) GetQArgKey ¶
func (bf BaseFilter) GetQArgKey() string
func (BaseFilter) GetQArgValues ¶
func (bf BaseFilter) GetQArgValues() []string
type Context ¶
type Context interface {
GetServer() Server
GetRequest() *http.Request
WriteToResponse(blob interface{})
SetUser(User)
GetUser() User
IncrementQueryCount()
QueryRow(string, ...interface{}) *sql.Row
Query(string, ...interface{}) (*sql.Rows, error)
Exec(string, ...interface{}) (sql.Result, error)
Begin() (Transaction, error)
InitCache()
FlushCache()
CacheObject(Instance, map[string]map[string][]string)
GetCachedObject(string, string) (Instance, map[string]map[string][]string)
GetObjectsByIDs(*Model, []string, *Include) ([]Instance, []Instance, error)
GetObjectsByIDsAllRelations(*Model, []string, *Include) ([]Instance, []Instance, error)
GetObjectsByFilter(
*Model,
[]string,
[]interface{},
string,
int,
int,
*Include,
) (
[]Instance,
[]Instance,
error,
)
CanAccessAllInstances([]Instance) bool
}
type ErrorSet ¶
type ErrorSet struct {
Errors []map[string]interface{} `json:"errors"`
}
func (ErrorSet) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (*ErrorSet) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
type InstancePointer ¶
func AssertInstancePointer ¶
func AssertInstancePointer(value interface{}) InstancePointer
func (InstancePointer) Equal ¶
func (ip InstancePointer) Equal(oip InstancePointer) bool
func (*InstancePointer) GetID ¶
func (ip *InstancePointer) GetID() string
func (*InstancePointer) GetType ¶
func (ip *InstancePointer) GetType() string
func (InstancePointer) MarshalEasyJSON ¶
func (v InstancePointer) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (*InstancePointer) SetID ¶
func (ip *InstancePointer) SetID(id string)
func (*InstancePointer) UnmarshalEasyJSON ¶
func (v *InstancePointer) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
type ManagerStub ¶
type ManagerStub struct {
}
func (ManagerStub) BeforeCreate ¶
func (stub ManagerStub) BeforeCreate(c Context, values map[string]interface{}) error
func (ManagerStub) BeforeSave ¶
func (stub ManagerStub) BeforeSave(c Context, values map[string]interface{}) error
func (ManagerStub) BeforeUpdate ¶
func (stub ManagerStub) BeforeUpdate( c Context, oldValues map[string]interface{}, newValues map[string]interface{}, ) error
func (ManagerStub) GetFilterForUser ¶
func (stub ManagerStub) GetFilterForUser(user User, nextArg int) ([]string, []interface{})
type Model ¶
type Model struct {
Type string
Table string
IDColumn string
IDGenerator func(Context) string
DefaultOrder string
Attributes []Attribute
Relationships []Relationship
Manager Manager
}
func (Model) DirectFields ¶
func (Model) ExtraFields ¶
type Page ¶
type Page struct {
Provided bool `json:"-"`
Metadata map[string]interface{} `json:"meta"`
Links map[string]*string `json:"links"`
Data []interface{} `json:"data"`
Included *[]interface{} `json:"included,omitempty"`
}
func (Page) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (*Page) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Page) UnmarshalJSON ¶
type Relationship ¶
type Relationship interface {
GetKey() string
GetType() string
GetSelectExtra() ([]string, []interface{})
AvailableFilters() []interface{}
ValidateFilters(map[string][]string) ([]Filter, error)
GetFilterWhere(int, map[string][]string) ([]string, []interface{})
GetDefaultValue() interface{}
GetValues(
Context,
*Model,
[]string,
[][]interface{},
int,
int,
) (
map[string]interface{},
map[string]map[string][]string,
)
GetInsert(interface{}) ([]string, []interface{})
GetInsertQueries(string, interface{}) []Query
GetUpdateQueries(string, interface{}, interface{}) []Query
DefaultFallback(Context, interface{}, interface{}) (interface{}, error)
Validate(Context, interface{}) (interface{}, error)
ValidateUpdate(Context, interface{}, interface{}) (interface{}, error)
}
type Result ¶
type Result struct {
Provided bool `json:"-"`
Links map[string]*string `json:"links"`
Data interface{} `json:"data"`
Included *[]interface{} `json:"included,omitempty"`
}
func (Result) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (*Result) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Result) UnmarshalJSON ¶
type Server ¶
type Server interface {
GetDatabase() Database
GetDefaultDirectPageSize() int
GetMaximumDirectPageSize() int
GetIndirectPageSize() int
GetModel(string) *Model
GetRoute(string) string
Whitespace() bool
UseEasyJSON() bool
LogSQL() bool
Authenticate(http.ResponseWriter, *http.Request, Context) (User, error)
}
type Transaction ¶
Click to show internal directories.
Click to hide internal directories.