Documentation ¶
Index ¶
- func ByID(tbl Table, idv ...string) error
- func Db() *sql.DB
- func FindOptionsFactory(tbl Table, uid string, param url.Values, idv []string) (*FindOptions, *ParamError)
- func Init() error
- func Pk(tbl Table) (f []string)
- func TaggedFields(tbl Table, tagName string, tagValues []string) ([]string, error)
- type BaseTable
- type ConflictError
- type FetchOptions
- type FetchResultSetMeta
- type FindOptions
- type FindResultSetMeta
- type NotAllowedError
- type NotFoundError
- type ParamError
- type Table
- type TableMeta
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindOptionsFactory ¶ added in v0.1.39
func FindOptionsFactory(tbl Table, uid string, param url.Values, idv []string) (*FindOptions, *ParamError)
FindOptionsFactory exported
func TaggedFields ¶ added in v0.1.35
TaggedFields returns a slice of db fields sharing a tag name (tn) such fields must be tagged as tn:"tv" the tagName value is passed in the tn parameter tagValues options are passed in the tv parameter ie.:
type User struct { UserID int64 `db:"user_id" auth:"id" json:"user_id" pk:"1"` RoleID *int64 `db:"role_id" auth:"role" json:"role_id"` Email string `db:"email" auth:"usr" json:"email"` }
v ar m User f, _ := TaggedFields(m, "auth", []string{"id","role","usr"}) f -> []string{"user_id","role_id","email"}
Types ¶
type ConflictError ¶ added in v0.1.35
ConflictError exported
type FetchOptions ¶ added in v0.1.36
type FetchOptions struct { Table Table UID string // ID from jwt, used to set scope in find, fetch, etc. Parents []Table // Also used to set scope in find, fetch, etc. Column []string IsNull []string IsNotNull []string In map[string][]interface{} NotIn map[string][]interface{} Equal map[string]string NotEqual map[string]string GreaterThan map[string]string LessThan map[string]string GreaterEqualThan map[string]string LessEqualThan map[string]string Order []string Offset int Limit int Checksum int Dig int // Flag used to include (or not) parent data in find, fetch, etc. }
FetchOptions exported
func FetchOptionsFactory ¶ added in v0.1.39
FetchOptionsFactory exported
type FetchResultSetMeta ¶ added in v0.1.39
FetchResultSetMeta exported
func Fetch ¶ added in v0.1.36
func Fetch(fo *FetchOptions) (FetchResultSetMeta, []interface{}, error)
Fetch exported
type FindOptions ¶ added in v0.1.39
FindOptions exported
type FindResultSetMeta ¶ added in v0.1.39
type FindResultSetMeta struct {
Checksum string
}
FindResultSetMeta exported
func Find ¶ added in v0.1.35
func Find(fo *FindOptions) (FindResultSetMeta, interface{}, error)
Find exported
type NotAllowedError ¶ added in v0.1.35
NotAllowedError exported
type NotFoundError ¶ added in v0.1.35
NotFoundError exported
type Table ¶ added in v0.1.33
type Table interface { // Must return the table name Name() string // Must attach foreign table data if available Dig() // Must set conditions to filter out content // not intended for the user making the request Scope(uid string, t ...Table) map[string]string }
Table exported
type TableMeta ¶ added in v0.1.36
type TableMeta struct { Fields []string Primary []string Serial []string View []string Writable []string }
TableMeta exported
func GetTableMeta ¶ added in v0.1.36
Returns the TableMeta object for tbl param. The underlying tbl struct must be properly annotated with Table related tags. TableMeta supports the tags: db, pk, view, serial.