Documentation ¶
Index ¶
- Variables
- func CompileQueryOptions(opts ...SelectOptions) (selec, order, limit string)
- func Dv(v interface{}) interface{}
- type DefaultDriver
- func (this DefaultDriver) BuildPathQuery(b builder.Builder, root *Node) builder.Builder
- func (this DefaultDriver) BuildPathQueryFromDepth(depth int32) (column, from, join string)
- func (this DefaultDriver) Children(ctx context.Context, id ID, b builder.Builder) (query string, args []interface{}, err error)
- func (this DefaultDriver) ControlDetail(ctx context.Context, id ID) (query string, args []interface{})
- func (this DefaultDriver) DDL() []string
- func (this DefaultDriver) DDLScheme(s Scheme) []string
- func (DefaultDriver) Delete(ctx context.Context, id ID, lft, rgt int64, iargs ...interface{}) (query string, args []interface{})
- func (this DefaultDriver) Detail(ctx context.Context, id ID) (query string, args []interface{})
- func (DefaultDriver) FindID(ctx context.Context, lft, rgt int64) (query string, args []interface{})
- func (this DefaultDriver) Insert(ctx context.Context, node *Node, name string, iargs ...interface{}) (query string, args []interface{})
- func (DefaultDriver) MaxRight(ctx context.Context) (query string, args []interface{})
- func (DefaultDriver) MoveAftersLeft(ctx context.Context, start, length int64) struct{ ... }
- func (DefaultDriver) MoveAftersRight(ctx context.Context, start, length int64) struct{ ... }
- func (DefaultDriver) MoveTreeRight(ctx context.Context, length, lft, rgt int64) (query string, args []interface{})
- func (this DefaultDriver) PathOf(ctx context.Context, id ID) (query string, args []interface{})
- func (this DefaultDriver) PathToID(ctx context.Context, pth string) (query string, args []interface{})
- func (this DefaultDriver) Scheme() *Scheme
- func (DefaultDriver) SelfSubTree(ctx context.Context, root, sub ID) (query string, args []interface{})
- func (this DefaultDriver) SetParentID(ctx context.Context, id, parentID ID) (query string, args []interface{})
- func (DefaultDriver) TreeTempSet(ctx context.Context, node *Node, depthDiff *int32) (query string, args []interface{})
- func (DefaultDriver) TreeTempUnset(ctx context.Context, node *Node, newLeft int64, depthDiff *int32) (query string, args []interface{})
- func (DefaultDriver) ValueToID(ctx context.Context, value interface{}) ID
- type Driver
- type Epoch
- type ID
- type Id
- type Nested
- func (this *Nested) DDL() []string
- func (this *Nested) Delete(ctx context.Context, tx *sql.Tx, recursive bool, id ID, args ...interface{}) (err error)
- func (this *Nested) DeleteOne(ctx context.Context, tx *sql.Tx, id ID, args ...interface{}) (err error)
- func (this *Nested) DeleteRecursive(ctx context.Context, tx *sql.Tx, id ID, args ...interface{}) (err error)
- func (this Nested) FindID(ctx context.Context, tx *sql.Tx, lft, rgt int64, dst ID) (err error)
- func (this *Nested) Insert(ctx context.Context, tx *sql.Tx, id, toId ID, name string, args ...interface{}) (node *Node, err error)
- func (this *Nested) InsertRoot(ctx context.Context, tx *sql.Tx, id ID, name string, args ...interface{}) (node *Node, err error)
- func (this Nested) MaxRight(ctx context.Context, tx *sql.Tx) (max int64, err error)
- func (this *Nested) Move(ctx context.Context, tx *sql.Tx, id, toId ID) (err error)
- func (this *Nested) MoveToRoot(ctx context.Context, tx *sql.Tx, id ID) (err error)
- func (this Nested) Node(ctx context.Context, tx *sql.Tx, id ID) (n *Node, err error)
- func (this *Nested) PathOf(ctx context.Context, tx *sql.Tx, id ID) (pth string, err error)
- func (this *Nested) PathToID(ctx context.Context, tx *sql.Tx, pth string, id ID) (err error)
- func (this Nested) Q(query string) string
- func (this Nested) Setup(ctx context.Context, db *sql.DB) (err error)
- type Node
- type Scheme
- type SchemeColumn
- type SchemeColumns
- type SchemeIndex
- type SchemeIndexes
- type SelectOptions
- func (this SelectOptions) Arg(args ...interface{}) SelectOptions
- func (this SelectOptions) Asc(v string) SelectOptions
- func (this SelectOptions) Desc(v string) SelectOptions
- func (this SelectOptions) Lim(limit int) SelectOptions
- func (this SelectOptions) Off(offset int) SelectOptions
- func (this SelectOptions) Scaner(s scanner.Scanner) SelectOptions
- func (this SelectOptions) Select(column ...string) SelectOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultScheme = Scheme{ Columns: SchemeColumns{ ID: SchemeColumn{"id", "INTEGER PRIMARY KEY AUTOINCREMENT"}, Lft: SchemeColumn{"lft", "INT NOT NULL"}, Rgt: SchemeColumn{"rgt", "INT NOT NULL"}, Name: SchemeColumn{"name", "VARCHAR(64) NOT NULL"}, Depth: SchemeColumn{"depth", "INT NOT NULL DEFAULT 0"}, ParentID: SchemeColumn{"parent_id", "BIGINT NOT NULL DEFAULT 0"}, DenyChildren: SchemeColumn{"deny_children", "BOOLEAN NOT NULL DEFAULT FALSE"}, }, Indexes: []SchemeIndex{ {Columns: []string{"name"}}, {Columns: []string{"depth"}}, {Columns: []string{"lft"}}, {Columns: []string{"rgt"}}, {ColumnsFunc: func(s Scheme, i SchemeIndex) []string { return []string{"parent_id", s.Columns.Name.Name} }, Unique: true}, }, }
Functions ¶
func CompileQueryOptions ¶
func CompileQueryOptions(opts ...SelectOptions) (selec, order, limit string)
Types ¶
type DefaultDriver ¶
type DefaultDriver struct { InsertColumns []string NewID func() ID // contains filtered or unexported fields }
func NewDefaultDriver ¶
func NewDefaultDriver() *DefaultDriver
func (DefaultDriver) BuildPathQuery ¶
func (DefaultDriver) BuildPathQueryFromDepth ¶
func (this DefaultDriver) BuildPathQueryFromDepth(depth int32) (column, from, join string)
func (DefaultDriver) ControlDetail ¶
func (this DefaultDriver) ControlDetail(ctx context.Context, id ID) (query string, args []interface{})
func (DefaultDriver) DDL ¶
func (this DefaultDriver) DDL() []string
func (DefaultDriver) DDLScheme ¶
func (this DefaultDriver) DDLScheme(s Scheme) []string
func (DefaultDriver) Detail ¶
func (this DefaultDriver) Detail(ctx context.Context, id ID) (query string, args []interface{})
func (DefaultDriver) FindID ¶
func (DefaultDriver) FindID(ctx context.Context, lft, rgt int64) (query string, args []interface{})
func (DefaultDriver) MaxRight ¶
func (DefaultDriver) MaxRight(ctx context.Context) (query string, args []interface{})
func (DefaultDriver) MoveAftersLeft ¶
func (DefaultDriver) MoveAftersLeft(ctx context.Context, start, length int64) struct { Lefts, Rigths struct { Query string Args []interface{} } }
func (DefaultDriver) MoveAftersRight ¶
func (DefaultDriver) MoveAftersRight(ctx context.Context, start, length int64) struct { Lefts, Rigths struct { Query string Args []interface{} } }
func (DefaultDriver) MoveTreeRight ¶
func (DefaultDriver) MoveTreeRight(ctx context.Context, length, lft, rgt int64) (query string, args []interface{})
func (DefaultDriver) PathOf ¶
func (this DefaultDriver) PathOf(ctx context.Context, id ID) (query string, args []interface{})
func (DefaultDriver) PathToID ¶
func (this DefaultDriver) PathToID(ctx context.Context, pth string) (query string, args []interface{})
func (DefaultDriver) Scheme ¶
func (this DefaultDriver) Scheme() *Scheme
func (DefaultDriver) SelfSubTree ¶
func (DefaultDriver) SelfSubTree(ctx context.Context, root, sub ID) (query string, args []interface{})
func (DefaultDriver) SetParentID ¶
func (this DefaultDriver) SetParentID(ctx context.Context, id, parentID ID) (query string, args []interface{})
func (DefaultDriver) TreeTempSet ¶
func (DefaultDriver) TreeTempUnset ¶
type Driver ¶
type Driver interface { FindID(ctx context.Context, lft, rgt int64) (query string, args []interface{}) Insert(ctx context.Context, node *Node, name string, iargs ...interface{}) (query string, args []interface{}) Detail(ctx context.Context, id ID) (query string, args []interface{}) ControlDetail(ctx context.Context, id ID) (query string, args []interface{}) Delete(ctx context.Context, id ID, lft, rgt int64, iargs ...interface{}) (query string, args []interface{}) PathOf(ctx context.Context, id ID) (query string, args []interface{}) PathToID(ctx context.Context, pth string) (query string, args []interface{}) SelfSubTree(ctx context.Context, root, sub ID) (query string, args []interface{}) SetParentID(ctx context.Context, id, parentID ID) (query string, args []interface{}) TreeTempSet(ctx context.Context, node *Node, depthDiff *int32) (query string, args []interface{}) TreeTempUnset(ctx context.Context, node *Node, newLeft int64, depthDiff *int32) (query string, args []interface{}) MoveAftersLeft(ctx context.Context, start, length int64) struct { Lefts, Rigths struct { Query string Args []interface{} } } MoveAftersRight(ctx context.Context, start, length int64) struct { Lefts, Rigths struct { Query string Args []interface{} } } MaxRight(ctx context.Context) (query string, args []interface{}) ValueToID(ctx context.Context, nodeId interface{}) ID Scheme() *Scheme DDL() []string }
type Id ¶
type Nested ¶
func (*Nested) DeleteRecursive ¶
func (*Nested) InsertRoot ¶
func (*Nested) MoveToRoot ¶
type Scheme ¶
type Scheme struct { Columns SchemeColumns Indexes SchemeIndexes }
type SchemeColumn ¶
func (SchemeColumn) DDL ¶
func (this SchemeColumn) DDL(s Scheme) (r string)
type SchemeColumns ¶
type SchemeColumns struct { ID, Lft, Rgt, Name, Depth, ParentID, DenyChildren SchemeColumn Other map[string]string }
func (SchemeColumns) DDL ¶
func (this SchemeColumns) DDL(s Scheme) (r []string)
type SchemeIndex ¶
type SchemeIndex struct { Name string Definition func(s Scheme, i SchemeIndex) string Columns []string ColumnsFunc func(s Scheme, i SchemeIndex) []string Unique bool }
func (SchemeIndex) DDL ¶
func (this SchemeIndex) DDL(s Scheme) (r string)
type SchemeIndexes ¶
type SchemeIndexes []SchemeIndex
func (SchemeIndexes) DDL ¶
func (this SchemeIndexes) DDL(s Scheme) (r []string)
type SelectOptions ¶
type SelectOptions struct { Args []interface{} Scanner scanner.Scanner Columns []string Order []struct { Name string Asc bool } Limit, Offset int }
func (SelectOptions) Arg ¶
func (this SelectOptions) Arg(args ...interface{}) SelectOptions
func (SelectOptions) Asc ¶
func (this SelectOptions) Asc(v string) SelectOptions
func (SelectOptions) Desc ¶
func (this SelectOptions) Desc(v string) SelectOptions
func (SelectOptions) Lim ¶
func (this SelectOptions) Lim(limit int) SelectOptions
func (SelectOptions) Off ¶
func (this SelectOptions) Off(offset int) SelectOptions
func (SelectOptions) Scaner ¶
func (this SelectOptions) Scaner(s scanner.Scanner) SelectOptions
func (SelectOptions) Select ¶
func (this SelectOptions) Select(column ...string) SelectOptions
Click to show internal directories.
Click to hide internal directories.