Documentation
¶
Index ¶
- Constants
- func String(node AdmNode) string
- type AddDbRouter
- type AddRoute
- type AddTableRouter
- type AdmNode
- type AlterDbRouter
- type AlterRoute
- type AlterTableRouter
- type Command
- type DeleteDbRouter
- type DeleteRoute
- type DeleteTableRouter
- type FromAdmin
- type HashRoute
- type KeyRangeRoute
- type KeyRangeRoutes
- type MirrorRoute
- type RangeNum
- type RangeRoute
- type Route
- type RouteID
- type Show
- type TableIdent
- type TableRouterDef
- type Tokenizer
- type TrackedBuffer
Constants ¶
const ( MirrorR = "r" MirrorW = "w" MirrorRW = "rw" )
MirrorRoute.Kind
const ADD = 57348
const ADMIN = 57347
const ALTER = 57349
const COMMENT = 57373
const DATABASE = 57353
const DEFAULT = 57352
const DELETE = 57350
const FROM = 57354
const HASH = 57355
const ID = 57369
const INF = 57356
const KEY = 57357
const KIND = 57358
const LEX_ERROR = 57346
const LIST_ARG = 57372
const MIRROR = 57359
const MIRRORS = 57360
const MODULO = 57361
const (
ModuloStr = "modulo"
)
HashRoute.Type
const NUMBER = 57371
const RANGE = 57363
const ROUTE = 57366
const ROUTER = 57368
const ROUTES = 57367
const SHOW = 57351
const STRING = 57370
const TABLE = 57364
const TO = 57362
const TYPE = 57365
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddDbRouter ¶
func (*AddDbRouter) Format ¶
func (n *AddDbRouter) Format(buf *TrackedBuffer)
type AddTableRouter ¶
func (*AddTableRouter) Format ¶
func (n *AddTableRouter) Format(buf *TrackedBuffer)
type AdmNode ¶
type AdmNode interface {
Format(buf *TrackedBuffer)
}
type AlterDbRouter ¶
func (*AlterDbRouter) Format ¶
func (n *AlterDbRouter) Format(buf *TrackedBuffer)
type AlterRoute ¶
func (*AlterRoute) Format ¶
func (n *AlterRoute) Format(buf *TrackedBuffer)
type AlterTableRouter ¶
func (*AlterTableRouter) Format ¶
func (n *AlterTableRouter) Format(buf *TrackedBuffer)
type DeleteDbRouter ¶
type DeleteDbRouter struct {
Db string
}
func (*DeleteDbRouter) Format ¶
func (n *DeleteDbRouter) Format(buf *TrackedBuffer)
type DeleteRoute ¶
type DeleteRoute struct {
Name string
}
func (*DeleteRoute) Format ¶
func (n *DeleteRoute) Format(buf *TrackedBuffer)
type DeleteTableRouter ¶
func (*DeleteTableRouter) Format ¶
func (n *DeleteTableRouter) Format(buf *TrackedBuffer)
type FromAdmin ¶
type FromAdmin struct{}
func (*FromAdmin) Format ¶
func (n *FromAdmin) Format(buf *TrackedBuffer)
type KeyRangeRoute ¶
func (KeyRangeRoute) Format ¶
func (n KeyRangeRoute) Format(buf *TrackedBuffer)
type KeyRangeRoutes ¶
type KeyRangeRoutes []KeyRangeRoute
func (KeyRangeRoutes) Format ¶
func (ns KeyRangeRoutes) Format(buf *TrackedBuffer)
type MirrorRoute ¶
func (*MirrorRoute) Format ¶
func (n *MirrorRoute) Format(buf *TrackedBuffer)
type RangeRoute ¶
type RangeRoute struct {
Ranges KeyRangeRoutes
}
func (*RangeRoute) Format ¶
func (n *RangeRoute) Format(buf *TrackedBuffer)
type RouteID ¶
type RouteID string
func (RouteID) Format ¶
func (n RouteID) Format(buf *TrackedBuffer)
type TableIdent ¶
type TableRouterDef ¶
type Tokenizer ¶
type Tokenizer struct {
InStream *strings.Reader
AllowComments bool
ForceEOF bool
Position int
LastError string
ParseTree Command
// contains filtered or unexported fields
}
Tokenizer is the struct used to generate SQL tokens for the parser.
func NewStringTokenizer ¶
NewStringTokenizer creates a new Tokenizer for the sql string.
type TrackedBuffer ¶
TrackedBuffer is used to rebuild a query from the ast. bindLocations keeps track of locations in the buffer that use bind variables for efficient future substitutions. nodeFormatter is the formatting function the buffer will use to format a node. By default(nil), it's FormatNode. But you can supply a different formatting function if you want to generate a query that's different from the default.
func NewTrackedBuffer ¶
func NewTrackedBuffer(nodeFormatter func(buf *TrackedBuffer, node AdmNode)) *TrackedBuffer
NewTrackedBuffer creates a new TrackedBuffer.
func (*TrackedBuffer) Myprintf ¶
func (buf *TrackedBuffer) Myprintf(format string, values ...interface{})
Myprintf mimics fmt.Fprintf(buf, ...), but limited to Node(%v), Node.Value(%s) and string(%s). It also allows a %a for a value argument, in which case it adds tracking info for future substitutions.
The name must be something other than the usual Printf() to avoid "go vet" warnings due to our custom format specifiers.