cockroach: github.com/abhinavdahiya/cockroach/sql/parser Index | Files

package parser

import "github.com/abhinavdahiya/cockroach/sql/parser"

Code generated by go yacc. GENERATED FILE DO NOT EDIT

Index

Package Files

aggregate_builtins.go alter_table.go builtins.go col_types.go constant.go create.go datum.go delete.go drop.go encode.go eval.go explain.go expr.go format.go grant.go indexed_vars.go indirection.go insert.go interval.go keywords.go name.go normalize.go overload.go parse.go placeholders.go prepare.go regexp_cache.go rename.go reserved_keywords.go returning.go revoke.go scan.go select.go set.go show.go sql.go stmt.go syntax_string.go truncate.go txn.go type_check.go union.go update.go values.go walk.go

Constants

const (
    Distinct funcType
    All
)

FuncExpr.Type

const ACTION = 57361
const ADD = 57362
const ALL = 57363
const ALTER = 57364
const ANALYSE = 57365
const ANALYZE = 57366
const AND = 57367
const ANNOTATE_TYPE = 57369
const ANY = 57368
const ARRAY = 57370
const AS = 57371
const ASC = 57372
const ASYMMETRIC = 57373
const AS_LA = 57618
const AT = 57374
const BCONST = 57348
const BEGIN = 57375
const BETWEEN = 57376
const BIGINT = 57377
const BIGSERIAL = 57378
const BIT = 57379
const BLOB = 57380
const BOOL = 57381
const BOOLEAN = 57382
const BOTH = 57383
const BY = 57384
const BYTEA = 57385
const BYTES = 57386
const CASCADE = 57387
const CASE = 57388
const CAST = 57389
const CHAR = 57390
const CHARACTER = 57391
const CHARACTERISTICS = 57392
const CHECK = 57393
const COALESCE = 57394
const COLLATE = 57395
const COLLATION = 57396
const COLUMN = 57397
const COLUMNS = 57398
const COMMIT = 57399
const COMMITTED = 57400
const CONCAT = 57401
const CONFLICT = 57402
const CONSTRAINT = 57403
const CONSTRAINTS = 57404
const COVERING = 57405
const CREATE = 57406
const CROSS = 57407
const CUBE = 57408
const CURRENT = 57409
const CURRENT_CATALOG = 57410
const CURRENT_DATE = 57411
const CURRENT_ROLE = 57412
const CURRENT_TIME = 57413
const CURRENT_TIMESTAMP = 57414
const CURRENT_USER = 57415
const CYCLE = 57416
const DATA = 57417
const DATABASE = 57418
const DATABASES = 57419
const DATE = 57420
const DAY = 57421
const DEALLOCATE = 57425
const DEC = 57422
const DECIMAL = 57423
const DEFAULT = 57424
const DEFERRABLE = 57426
const DELETE = 57427
const DESC = 57428
const DISTINCT = 57429
const DO = 57430
const DOT_DOT = 57353
const DOUBLE = 57431
const DROP = 57432
const ELSE = 57433
const ENCODING = 57434
const END = 57435
const ERROR = 57360
const ESCAPE = 57436
const EXCEPT = 57437
const EXECUTE = 57439
const EXISTS = 57438
const EXPLAIN = 57440
const EXTRACT = 57441
const FALSE = 57442
const FAMILY = 57443
const FCONST = 57350
const FETCH = 57444
const FILTER = 57445
const FIRST = 57446
const FLOAT = 57447
const FLOORDIV = 57448
const FOLLOWING = 57449
const FOR = 57450
const FORCE_INDEX = 57451
const FOREIGN = 57452
const FROM = 57453
const FULL = 57454
const GRANT = 57455
const GRANTS = 57456
const GREATER_EQUALS = 57355
const GREATEST = 57457
const GROUP = 57458
const GROUPING = 57459
const HAVING = 57460
const HIGH = 57461
const HOUR = 57462
const ICONST = 57349
const IDENT = 57346
const IF = 57463
const IFNULL = 57464
const ILIKE = 57465
const IN = 57466
const INDEX = 57468
const INDEXES = 57469
const INITIALLY = 57470
const INNER = 57471
const INSERT = 57472
const INT = 57473
const INT64 = 57474
const INTEGER = 57475
const INTERLEAVE = 57467
const INTERSECT = 57476
const INTERVAL = 57477
const INTO = 57478
const IS = 57479
const ISOLATION = 57480
const JOIN = 57481
const KEY = 57482
const KEYS = 57483
const LATERAL = 57484
const LEADING = 57485
const LEAST = 57486
const LEFT = 57487
const LESS_EQUALS = 57354
const LEVEL = 57488
const LIKE = 57489
const LIMIT = 57490
const LOCAL = 57491
const LOCALTIME = 57492
const LOCALTIMESTAMP = 57493
const LOW = 57494
const LSHIFT = 57495
const MATCH = 57496
const MINUTE = 57497
const MONTH = 57498
const NAME = 57499
const NAMES = 57500
const NATURAL = 57501
const NEXT = 57502
const NO = 57503
const NORMAL = 57505
const NOT = 57506
const NOTHING = 57507
const NOT_EQUALS = 57356
const NOT_LA = 57616
const NOT_REGIMATCH = 57359
const NOT_REGMATCH = 57357
const NO_INDEX_JOIN = 57504
const NULL = 57508
const NULLIF = 57509
const NULLS = 57510
const NUMERIC = 57511
const OF = 57512
const OFF = 57513
const OFFSET = 57514
const ON = 57515
const ONLY = 57516
const OR = 57517
const ORDER = 57518
const ORDINALITY = 57519
const OUT = 57520
const OUTER = 57521
const OVER = 57522
const OVERLAPS = 57523
const OVERLAY = 57524
const PARENT = 57525
const PARTIAL = 57526
const PARTITION = 57527
const PLACEHOLDER = 57351
const PLACING = 57528
const POSITION = 57529
const POSTFIXOP = 57619
const PRECEDING = 57530
const PRECISION = 57531
const PREPARE = 57532
const PRIMARY = 57533
const PRIORITY = 57534
const RANGE = 57535
const READ = 57536
const REAL = 57537
const RECURSIVE = 57538
const REF = 57539
const REFERENCES = 57540
const REGIMATCH = 57358
const RELEASE = 57543
const RENAME = 57541
const REPEATABLE = 57542
const RESTRICT = 57544
const RETURNING = 57545
const REVOKE = 57546
const RIGHT = 57547
const ROLLBACK = 57548
const ROLLUP = 57549
const ROW = 57550
const ROWS = 57551
const RSHIFT = 57552
const RestartSavepointName string = "COCKROACH_RESTART"

RestartSavepointName is the only savepoint name that we accept, modulo capitalization.

const SAVEPOINT = 57553
const SCONST = 57347
const SEARCH = 57554
const SECOND = 57555
const SELECT = 57556
const SERIAL = 57557
const SERIALIZABLE = 57558
const SESSION = 57559
const SESSION_USER = 57560
const SET = 57561
const SHOW = 57562
const SIMILAR = 57563
const SIMPLE = 57564
const SMALLINT = 57565
const SMALLSERIAL = 57566
const SNAPSHOT = 57567
const SOME = 57568
const SQL = 57569
const START = 57570
const STORING = 57573
const STRICT = 57571
const STRING = 57572
const SUBSTRING = 57574
const SYMMETRIC = 57575
const SYSTEM = 57576
const TABLE = 57577
const TABLES = 57578
const TEXT = 57579
const THEN = 57580
const TIME = 57581
const TIMESTAMP = 57582
const TIMESTAMPTZ = 57583
const TO = 57584
const TRAILING = 57585
const TRANSACTION = 57586
const TREAT = 57587
const TRIM = 57588
const TRUE = 57589
const TRUNCATE = 57590
const TYPE = 57591
const TYPECAST = 57352
const UMINUS = 57620
const UNBOUNDED = 57592
const UNCOMMITTED = 57593
const UNION = 57594
const UNIQUE = 57595
const UNKNOWN = 57596
const UPDATE = 57597
const UPSERT = 57598
const USER = 57599
const USING = 57600
const VALID = 57601
const VALIDATE = 57602
const VALUE = 57603
const VALUES = 57604
const VARCHAR = 57605
const VARIADIC = 57606
const VARYING = 57607
const WHEN = 57608
const WHERE = 57609
const WINDOW = 57610
const WITH = 57611
const WITHIN = 57612
const WITHOUT = 57613
const WITH_LA = 57617
const YEAR = 57614
const ZONE = 57615

Variables

var (

    // DBoolTrue is a pointer to the DBool(true) value and can be used in
    // comparisons against Datum types.
    DBoolTrue = &constDBoolTrue
    // DBoolFalse is a pointer to the DBool(false) value and can be used in
    // comparisons against Datum types.
    DBoolFalse = &constDBoolFalse

    // DNull is the NULL Datum.
    DNull Datum = dNull{}
)
var Aggregates = map[string][]Builtin{
    "avg": {
        makeAggBuiltin(TypeInt, TypeDecimal, newAvgAggregate),
        makeAggBuiltin(TypeFloat, TypeFloat, newAvgAggregate),
        makeAggBuiltin(TypeDecimal, TypeDecimal, newAvgAggregate),
    },

    "bool_and": {
        makeAggBuiltin(TypeBool, TypeBool, newBoolAndAggregate),
    },

    "bool_or": {
        makeAggBuiltin(TypeBool, TypeBool, newBoolOrAggregate),
    },

    "count": countImpls(),

    "max": makeAggBuiltins(newMaxAggregate, TypeBool, TypeInt, TypeFloat, TypeDecimal, TypeString, TypeBytes, TypeDate, TypeTimestamp, TypeInterval),
    "min": makeAggBuiltins(newMinAggregate, TypeBool, TypeInt, TypeFloat, TypeDecimal, TypeString, TypeBytes, TypeDate, TypeTimestamp, TypeInterval),

    "sum": {
        makeAggBuiltin(TypeInt, TypeDecimal, newSumAggregate),
        makeAggBuiltin(TypeFloat, TypeFloat, newSumAggregate),
        makeAggBuiltin(TypeDecimal, TypeDecimal, newSumAggregate),
    },

    "variance": {
        makeAggBuiltin(TypeInt, TypeDecimal, newVarianceAggregate),
        makeAggBuiltin(TypeDecimal, TypeDecimal, newVarianceAggregate),
        makeAggBuiltin(TypeFloat, TypeFloat, newVarianceAggregate),
    },

    "stddev": {
        makeAggBuiltin(TypeInt, TypeDecimal, newStddevAggregate),
        makeAggBuiltin(TypeDecimal, TypeDecimal, newStddevAggregate),
        makeAggBuiltin(TypeFloat, TypeFloat, newStddevAggregate),
    },
}

Aggregates are a special class of builtin functions that are wrapped at execution in a bucketing layer to combine (aggregate) the result of the function being run over many rows. See `aggregateFuncHolder` in the sql In particular they must not be simplified during normalization (and thus must be marked as impure), even when they are given a constant argument (e.g. SUM(1)). This is because aggregate functions must return NULL when they are no rows in the source table, so their evaluation must always be delayed until query execution.

var BinOps = map[BinaryOperator]binOpOverload{
    Bitand: {
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeInt,
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDInt(*left.(*DInt) & *right.(*DInt)), nil
            },
        },
    },

    Bitor: {
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeInt,
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDInt(*left.(*DInt) | *right.(*DInt)), nil
            },
        },
    },

    Bitxor: {
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeInt,
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDInt(*left.(*DInt) ^ *right.(*DInt)), nil
            },
        },
    },

    Plus: {
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeInt,
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDInt(*left.(*DInt) + *right.(*DInt)), nil
            },
        },
        BinOp{
            LeftType:   TypeFloat,
            RightType:  TypeFloat,
            ReturnType: TypeFloat,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDFloat(*left.(*DFloat) + *right.(*DFloat)), nil
            },
        },
        BinOp{
            LeftType:   TypeDecimal,
            RightType:  TypeDecimal,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := &left.(*DDecimal).Dec
                r := &right.(*DDecimal).Dec
                dd := &DDecimal{}
                dd.Add(l, r)
                return dd, nil
            },
        },
        BinOp{
            LeftType:   TypeDate,
            RightType:  TypeInt,
            ReturnType: TypeDate,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDDate(*left.(*DDate) + DDate(*right.(*DInt))), nil
            },
        },
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeDate,
            ReturnType: TypeDate,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDDate(DDate(*left.(*DInt)) + *right.(*DDate)), nil
            },
        },
        BinOp{
            LeftType:   TypeTimestamp,
            RightType:  TypeInterval,
            ReturnType: TypeTimestamp,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return MakeDTimestamp(duration.Add(left.(*DTimestamp).Time, right.(*DInterval).Duration), time.Microsecond), nil
            },
        },
        BinOp{
            LeftType:   TypeInterval,
            RightType:  TypeTimestamp,
            ReturnType: TypeTimestamp,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return MakeDTimestamp(duration.Add(right.(*DTimestamp).Time, left.(*DInterval).Duration), time.Microsecond), nil
            },
        },
        BinOp{
            LeftType:   TypeTimestampTZ,
            RightType:  TypeInterval,
            ReturnType: TypeTimestampTZ,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                t := duration.Add(left.(*DTimestampTZ).Time, right.(*DInterval).Duration)
                return MakeDTimestampTZ(t, time.Microsecond), nil
            },
        },
        BinOp{
            LeftType:   TypeInterval,
            RightType:  TypeTimestampTZ,
            ReturnType: TypeTimestampTZ,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                t := duration.Add(right.(*DTimestampTZ).Time, left.(*DInterval).Duration)
                return MakeDTimestampTZ(t, time.Microsecond), nil
            },
        },
        BinOp{
            LeftType:   TypeInterval,
            RightType:  TypeInterval,
            ReturnType: TypeInterval,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return &DInterval{Duration: left.(*DInterval).Duration.Add(right.(*DInterval).Duration)}, nil
            },
        },
    },

    Minus: {
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeInt,
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDInt(*left.(*DInt) - *right.(*DInt)), nil
            },
        },
        BinOp{
            LeftType:   TypeFloat,
            RightType:  TypeFloat,
            ReturnType: TypeFloat,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDFloat(*left.(*DFloat) - *right.(*DFloat)), nil
            },
        },
        BinOp{
            LeftType:   TypeDecimal,
            RightType:  TypeDecimal,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := &left.(*DDecimal).Dec
                r := &right.(*DDecimal).Dec
                dd := &DDecimal{}
                dd.Sub(l, r)
                return dd, nil
            },
        },
        BinOp{
            LeftType:   TypeDate,
            RightType:  TypeInt,
            ReturnType: TypeDate,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDDate(*left.(*DDate) - DDate(*right.(*DInt))), nil
            },
        },
        BinOp{
            LeftType:   TypeDate,
            RightType:  TypeDate,
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDInt(DInt(*left.(*DDate) - *right.(*DDate))), nil
            },
        },
        BinOp{
            LeftType:   TypeTimestamp,
            RightType:  TypeTimestamp,
            ReturnType: TypeInterval,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                nanos := left.(*DTimestamp).Sub(right.(*DTimestamp).Time).Nanoseconds()
                return &DInterval{Duration: duration.Duration{Nanos: nanos}}, nil
            },
        },
        BinOp{
            LeftType:   TypeTimestampTZ,
            RightType:  TypeTimestampTZ,
            ReturnType: TypeInterval,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                nanos := left.(*DTimestampTZ).Sub(right.(*DTimestampTZ).Time).Nanoseconds()
                return &DInterval{Duration: duration.Duration{Nanos: nanos}}, nil
            },
        },
        BinOp{
            LeftType:   TypeTimestamp,
            RightType:  TypeInterval,
            ReturnType: TypeTimestamp,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return MakeDTimestamp(duration.Add(left.(*DTimestamp).Time, right.(*DInterval).Duration.Mul(-1)), time.Microsecond), nil
            },
        },
        BinOp{
            LeftType:   TypeTimestampTZ,
            RightType:  TypeInterval,
            ReturnType: TypeTimestampTZ,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                t := duration.Add(left.(*DTimestampTZ).Time, right.(*DInterval).Duration.Mul(-1))
                return MakeDTimestampTZ(t, time.Microsecond), nil
            },
        },
        BinOp{
            LeftType:   TypeInterval,
            RightType:  TypeInterval,
            ReturnType: TypeInterval,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return &DInterval{Duration: left.(*DInterval).Duration.Sub(right.(*DInterval).Duration)}, nil
            },
        },
    },

    Mult: {
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeInt,
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDInt(*left.(*DInt) * *right.(*DInt)), nil
            },
        },
        BinOp{
            LeftType:   TypeFloat,
            RightType:  TypeFloat,
            ReturnType: TypeFloat,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDFloat(*left.(*DFloat) * *right.(*DFloat)), nil
            },
        },

        BinOp{
            LeftType:   TypeDecimal,
            RightType:  TypeInt,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := &left.(*DDecimal).Dec
                r := *right.(*DInt)
                dd := &DDecimal{}
                dd.SetUnscaled(int64(r))
                dd.Mul(&dd.Dec, l)
                return dd, nil
            },
        },
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeDecimal,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := *left.(*DInt)
                r := &right.(*DDecimal).Dec
                dd := &DDecimal{}
                dd.SetUnscaled(int64(l))
                dd.Mul(&dd.Dec, r)
                return dd, nil
            },
        },
        BinOp{
            LeftType:   TypeDecimal,
            RightType:  TypeDecimal,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := &left.(*DDecimal).Dec
                r := &right.(*DDecimal).Dec
                dd := &DDecimal{}
                dd.Mul(l, r)
                return dd, nil
            },
        },
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeInterval,
            ReturnType: TypeInterval,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return &DInterval{Duration: right.(*DInterval).Duration.Mul(int64(*left.(*DInt)))}, nil
            },
        },
        BinOp{
            LeftType:   TypeInterval,
            RightType:  TypeInt,
            ReturnType: TypeInterval,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return &DInterval{Duration: left.(*DInterval).Duration.Mul(int64(*right.(*DInt)))}, nil
            },
        },
    },

    Div: {
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeInt,
            ReturnType: TypeDecimal,
            fn: func(ctx *EvalContext, left Datum, right Datum) (Datum, error) {
                rInt := *right.(*DInt)
                if rInt == 0 {
                    return nil, errDivByZero
                }
                div := ctx.getTmpDec().SetUnscaled(int64(rInt)).SetScale(0)
                dd := &DDecimal{}
                dd.SetUnscaled(int64(*left.(*DInt)))
                dd.QuoRound(&dd.Dec, div, decimal.Precision, inf.RoundHalfUp)
                return dd, nil
            },
        },
        BinOp{
            LeftType:   TypeFloat,
            RightType:  TypeFloat,
            ReturnType: TypeFloat,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDFloat(*left.(*DFloat) / *right.(*DFloat)), nil
            },
        },
        BinOp{
            LeftType:   TypeDecimal,
            RightType:  TypeDecimal,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := &left.(*DDecimal).Dec
                r := &right.(*DDecimal).Dec
                if r.Sign() == 0 {
                    return nil, errDivByZero
                }
                dd := &DDecimal{}
                dd.QuoRound(l, r, decimal.Precision, inf.RoundHalfUp)
                return dd, nil
            },
        },
        BinOp{
            LeftType:   TypeInterval,
            RightType:  TypeInt,
            ReturnType: TypeInterval,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                rInt := *right.(*DInt)
                if rInt == 0 {
                    return nil, errDivByZero
                }
                return &DInterval{Duration: left.(*DInterval).Duration.Div(int64(rInt))}, nil
            },
        },
    },

    FloorDiv: {
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeInt,
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                rInt := *right.(*DInt)
                if rInt == 0 {
                    return nil, errDivByZero
                }
                return NewDInt(*left.(*DInt) / rInt), nil
            },
        },
        BinOp{
            LeftType:   TypeFloat,
            RightType:  TypeFloat,
            ReturnType: TypeFloat,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := float64(*left.(*DFloat))
                r := float64(*right.(*DFloat))
                return NewDFloat(DFloat(math.Trunc(l / r))), nil
            },
        },
        BinOp{
            LeftType:   TypeDecimal,
            RightType:  TypeDecimal,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := left.(*DDecimal).Dec
                r := right.(*DDecimal).Dec
                if r.Sign() == 0 {
                    return nil, errZeroModulus
                }
                dd := &DDecimal{}
                dd.QuoRound(&l, &r, 0, inf.RoundDown)
                return dd, nil
            },
        },
    },

    Mod: {
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeInt,
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                r := *right.(*DInt)
                if r == 0 {
                    return nil, errZeroModulus
                }
                return NewDInt(*left.(*DInt) % r), nil
            },
        },
        BinOp{
            LeftType:   TypeFloat,
            RightType:  TypeFloat,
            ReturnType: TypeFloat,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDFloat(DFloat(math.Mod(float64(*left.(*DFloat)), float64(*right.(*DFloat))))), nil
            },
        },
        BinOp{
            LeftType:   TypeDecimal,
            RightType:  TypeDecimal,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := &left.(*DDecimal).Dec
                r := &right.(*DDecimal).Dec
                if r.Sign() == 0 {
                    return nil, errZeroModulus
                }
                dd := &DDecimal{}
                decimal.Mod(&dd.Dec, l, r)
                return dd, nil
            },
        },
    },

    Concat: {
        BinOp{
            LeftType:   TypeString,
            RightType:  TypeString,
            ReturnType: TypeString,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDString(string(*left.(*DString) + *right.(*DString))), nil
            },
        },
        BinOp{
            LeftType:   TypeBytes,
            RightType:  TypeBytes,
            ReturnType: TypeBytes,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDBytes(*left.(*DBytes) + *right.(*DBytes)), nil
            },
        },
    },

    LShift: {
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeInt,
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDInt(*left.(*DInt) << uint(*right.(*DInt))), nil
            },
        },
    },

    RShift: {
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeInt,
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDInt(*left.(*DInt) >> uint(*right.(*DInt))), nil
            },
        },
    },
}

BinOps contains the binary operations indexed by operation type.

var Builtins = map[string][]Builtin{

    "length": {
        stringBuiltin1(func(s string) (Datum, error) {
            return NewDInt(DInt(utf8.RuneCountInString(s))), nil
        }, TypeInt),
        bytesBuiltin1(func(s string) (Datum, error) {
            return NewDInt(DInt(len(s))), nil
        }, TypeInt),
    },

    "octet_length": {
        stringBuiltin1(func(s string) (Datum, error) {
            return NewDInt(DInt(len(s))), nil
        }, TypeInt),
        bytesBuiltin1(func(s string) (Datum, error) {
            return NewDInt(DInt(len(s))), nil
        }, TypeInt),
    },

    "lower": {stringBuiltin1(func(s string) (Datum, error) {
        return NewDString(strings.ToLower(s)), nil
    }, TypeString)},

    "upper": {stringBuiltin1(func(s string) (Datum, error) {
        return NewDString(strings.ToUpper(s)), nil
    }, TypeString)},

    "substr":    substringImpls,
    "substring": substringImpls,

    "concat": {
        Builtin{
            Types:      VariadicType{TypeString},
            ReturnType: TypeString,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {
                var buffer bytes.Buffer
                for _, d := range args {
                    if d == DNull {
                        continue
                    }
                    buffer.WriteString(string(*d.(*DString)))
                }
                return NewDString(buffer.String()), nil
            },
        },
    },

    "concat_ws": {
        Builtin{
            Types:      VariadicType{TypeString},
            ReturnType: TypeString,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {
                dstr, ok := args[0].(*DString)
                if !ok {
                    return DNull, fmt.Errorf("unknown signature for concat_ws: concat_ws(%s, ...)", args[0].Type())
                }
                sep := string(*dstr)
                var ss []string
                for _, d := range args[1:] {
                    if d == DNull {
                        continue
                    }
                    ss = append(ss, string(*d.(*DString)))
                }
                return NewDString(strings.Join(ss, sep)), nil
            },
        },
    },

    "split_part": {
        Builtin{
            Types:      ArgTypes{TypeString, TypeString, TypeInt},
            ReturnType: TypeString,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {
                text := string(*args[0].(*DString))
                sep := string(*args[1].(*DString))
                field := int(*args[2].(*DInt))

                if field <= 0 {
                    return DNull, fmt.Errorf("field position %d must be greater than zero", field)
                }

                splits := strings.Split(text, sep)
                if field > len(splits) {
                    return NewDString(""), nil
                }
                return NewDString(splits[field-1]), nil
            },
        },
    },

    "repeat": {
        Builtin{
            Types:      ArgTypes{TypeString, TypeInt},
            ReturnType: TypeString,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {
                s := string(*args[0].(*DString))
                count := int(*args[1].(*DInt))
                if count < 0 {
                    count = 0
                }
                return NewDString(strings.Repeat(s, count)), nil
            },
        },
    },

    "ascii": {stringBuiltin1(func(s string) (Datum, error) {
        for _, ch := range s {
            return NewDInt(DInt(ch)), nil
        }
        return nil, errEmptyInputString
    }, TypeInt)},

    "md5": {stringBuiltin1(func(s string) (Datum, error) {
        return NewDString(fmt.Sprintf("%x", md5.Sum([]byte(s)))), nil
    }, TypeString)},

    "sha1": {stringBuiltin1(func(s string) (Datum, error) {
        return NewDString(fmt.Sprintf("%x", sha1.Sum([]byte(s)))), nil
    }, TypeString)},

    "sha256": {stringBuiltin1(func(s string) (Datum, error) {
        return NewDString(fmt.Sprintf("%x", sha256.Sum256([]byte(s)))), nil
    }, TypeString)},

    "to_hex": {
        Builtin{
            Types:      ArgTypes{TypeInt},
            ReturnType: TypeString,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {
                return NewDString(fmt.Sprintf("%x", int64(*args[0].(*DInt)))), nil
            },
        },
    },

    "strpos": {stringBuiltin2(func(s, substring string) (Datum, error) {
        index := strings.Index(s, substring)
        if index < 0 {
            return NewDInt(0), nil
        }

        return NewDInt(DInt(utf8.RuneCountInString(s[:index]) + 1)), nil
    }, TypeInt)},

    "overlay": {
        Builtin{
            Types:      ArgTypes{TypeString, TypeString, TypeInt},
            ReturnType: TypeString,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {
                s := string(*args[0].(*DString))
                to := string(*args[1].(*DString))
                pos := int(*args[2].(*DInt))
                size := utf8.RuneCountInString(to)
                return overlay(s, to, pos, size)
            },
        },
        Builtin{
            Types:      ArgTypes{TypeString, TypeString, TypeInt, TypeInt},
            ReturnType: TypeString,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {
                s := string(*args[0].(*DString))
                to := string(*args[1].(*DString))
                pos := int(*args[2].(*DInt))
                size := int(*args[3].(*DInt))
                return overlay(s, to, pos, size)
            },
        },
    },

    "btrim": {
        stringBuiltin2(func(s, chars string) (Datum, error) {
            return NewDString(strings.Trim(s, chars)), nil
        }, TypeString),
        stringBuiltin1(func(s string) (Datum, error) {
            return NewDString(strings.TrimSpace(s)), nil
        }, TypeString),
    },

    "ltrim": {
        stringBuiltin2(func(s, chars string) (Datum, error) {
            return NewDString(strings.TrimLeft(s, chars)), nil
        }, TypeString),
        stringBuiltin1(func(s string) (Datum, error) {
            return NewDString(strings.TrimLeftFunc(s, unicode.IsSpace)), nil
        }, TypeString),
    },

    "rtrim": {
        stringBuiltin2(func(s, chars string) (Datum, error) {
            return NewDString(strings.TrimRight(s, chars)), nil
        }, TypeString),
        stringBuiltin1(func(s string) (Datum, error) {
            return NewDString(strings.TrimRightFunc(s, unicode.IsSpace)), nil
        }, TypeString),
    },

    "reverse": {stringBuiltin1(func(s string) (Datum, error) {
        runes := []rune(s)
        for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
            runes[i], runes[j] = runes[j], runes[i]
        }
        return NewDString(string(runes)), nil
    }, TypeString)},

    "replace": {stringBuiltin3(func(s, from, to string) (Datum, error) {
        return NewDString(strings.Replace(s, from, to, -1)), nil
    }, TypeString)},

    "translate": {stringBuiltin3(func(s, from, to string) (Datum, error) {
        const deletionRune = utf8.MaxRune + 1
        translation := make(map[rune]rune, len(from))
        for _, fromRune := range from {
            toRune, size := utf8.DecodeRuneInString(to)
            if toRune == utf8.RuneError {
                toRune = deletionRune
            } else {
                to = to[size:]
            }
            translation[fromRune] = toRune
        }

        runes := make([]rune, 0, len(s))
        for _, c := range s {
            if t, ok := translation[c]; ok {
                if t != deletionRune {
                    runes = append(runes, t)
                }
            } else {
                runes = append(runes, c)
            }
        }
        return NewDString(string(runes)), nil
    }, TypeString)},

    "regexp_extract": {
        Builtin{
            Types:      ArgTypes{TypeString, TypeString},
            ReturnType: TypeString,
            fn: func(ctx *EvalContext, args DTuple) (Datum, error) {
                s := string(*args[0].(*DString))
                pattern := string(*args[1].(*DString))
                return regexpExtract(ctx, s, pattern, `\`)
            },
        },
    },

    "regexp_replace": {
        Builtin{
            Types:      ArgTypes{TypeString, TypeString, TypeString},
            ReturnType: TypeString,
            fn: func(ctx *EvalContext, args DTuple) (Datum, error) {
                s := string(*args[0].(*DString))
                pattern := string(*args[1].(*DString))
                to := string(*args[2].(*DString))
                return regexpReplace(ctx, s, pattern, to, "")
            },
        },
        Builtin{
            Types:      ArgTypes{TypeString, TypeString, TypeString, TypeString},
            ReturnType: TypeString,
            fn: func(ctx *EvalContext, args DTuple) (Datum, error) {
                s := string(*args[0].(*DString))
                pattern := string(*args[1].(*DString))
                to := string(*args[2].(*DString))
                sqlFlags := string(*args[3].(*DString))
                return regexpReplace(ctx, s, pattern, to, sqlFlags)
            },
        },
    },

    "initcap": {stringBuiltin1(func(s string) (Datum, error) {
        return NewDString(strings.Title(strings.ToLower(s))), nil
    }, TypeString)},

    "left": {
        Builtin{
            Types:      ArgTypes{TypeBytes, TypeInt},
            ReturnType: TypeBytes,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {
                bytes := []byte(*args[0].(*DBytes))
                n := int(*args[1].(*DInt))

                if n < -len(bytes) {
                    n = 0
                } else if n < 0 {
                    n = len(bytes) + n
                } else if n > len(bytes) {
                    n = len(bytes)
                }
                return NewDBytes(DBytes(bytes[:n])), nil
            },
        },
        Builtin{
            Types:      ArgTypes{TypeString, TypeInt},
            ReturnType: TypeString,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {
                runes := []rune(string(*args[0].(*DString)))
                n := int(*args[1].(*DInt))

                if n < -len(runes) {
                    n = 0
                } else if n < 0 {
                    n = len(runes) + n
                } else if n > len(runes) {
                    n = len(runes)
                }
                return NewDString(string(runes[:n])), nil
            },
        },
    },

    "right": {
        Builtin{
            Types:      ArgTypes{TypeBytes, TypeInt},
            ReturnType: TypeBytes,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {
                bytes := []byte(*args[0].(*DBytes))
                n := int(*args[1].(*DInt))

                if n < -len(bytes) {
                    n = 0
                } else if n < 0 {
                    n = len(bytes) + n
                } else if n > len(bytes) {
                    n = len(bytes)
                }
                return NewDBytes(DBytes(bytes[len(bytes)-n:])), nil
            },
        },
        Builtin{
            Types:      ArgTypes{TypeString, TypeInt},
            ReturnType: TypeString,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {
                runes := []rune(string(*args[0].(*DString)))
                n := int(*args[1].(*DInt))

                if n < -len(runes) {
                    n = 0
                } else if n < 0 {
                    n = len(runes) + n
                } else if n > len(runes) {
                    n = len(runes)
                }
                return NewDString(string(runes[len(runes)-n:])), nil
            },
        },
    },

    "random": {
        Builtin{
            Types:      ArgTypes{},
            ReturnType: TypeFloat,
            impure:     true,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {
                return NewDFloat(DFloat(rand.Float64())), nil
            },
        },
    },

    "experimental_unique_bytes": {
        Builtin{
            Types:      ArgTypes{},
            ReturnType: TypeBytes,
            category:   categoryIDGeneration,
            impure:     true,
            fn: func(ctx *EvalContext, args DTuple) (Datum, error) {
                return NewDBytes(generateUniqueBytes(ctx.NodeID)), nil
            },
        },
    },

    "unique_rowid": {
        Builtin{
            Types:      ArgTypes{},
            ReturnType: TypeInt,
            category:   categoryIDGeneration,
            impure:     true,
            fn: func(ctx *EvalContext, args DTuple) (Datum, error) {
                return NewDInt(generateUniqueInt(ctx.NodeID)), nil
            },
        },
    },

    "experimental_uuid_v4": {uuidV4Impl},
    "uuid_v4":              {uuidV4Impl},

    "greatest": {
        Builtin{
            Types:      AnyType{},
            ReturnType: nil,
            category:   categoryComparison,
            fn: func(ctx *EvalContext, args DTuple) (Datum, error) {
                return pickFromTuple(ctx, true, args)
            },
        },
    },

    "least": {
        Builtin{
            Types:      AnyType{},
            ReturnType: nil,
            category:   categoryComparison,
            fn: func(ctx *EvalContext, args DTuple) (Datum, error) {
                return pickFromTuple(ctx, false, args)
            },
        },
    },

    "age": {
        Builtin{
            Types:      ArgTypes{TypeTimestamp},
            ReturnType: TypeInterval,
            fn: func(ctx *EvalContext, args DTuple) (Datum, error) {
                return timestampMinusBinOp.fn(ctx, ctx.GetTxnTimestamp(time.Microsecond), args[0])
            },
        },
        Builtin{
            Types:      ArgTypes{TypeTimestamp, TypeTimestamp},
            ReturnType: TypeInterval,
            fn: func(ctx *EvalContext, args DTuple) (Datum, error) {
                return timestampMinusBinOp.fn(ctx, args[0], args[1])
            },
        },
    },

    "current_date": {
        Builtin{
            Types:      ArgTypes{},
            ReturnType: TypeDate,
            fn: func(ctx *EvalContext, args DTuple) (Datum, error) {
                t := ctx.GetTxnTimestamp(time.Microsecond).Time
                return NewDDateFromTime(t, ctx.GetLocation()), nil
            },
        },
    },

    "now":                   {txnTSImpl},
    "current_timestamp":     {txnTSImpl},
    "transaction_timestamp": {txnTSImpl},

    "statement_timestamp": {
        Builtin{
            Types:      ArgTypes{},
            ReturnType: TypeTimestamp,
            impure:     true,
            fn: func(ctx *EvalContext, args DTuple) (Datum, error) {
                return ctx.GetStmtTimestamp(), nil
            },
        },
    },

    "cluster_logical_timestamp": {
        Builtin{
            Types:      ArgTypes{},
            ReturnType: TypeDecimal,
            category:   categorySystemInfo,
            impure:     true,
            fn: func(ctx *EvalContext, args DTuple) (Datum, error) {
                return ctx.GetClusterTimestamp(), nil
            },
        },
    },

    "clock_timestamp": {
        Builtin{
            Types:      ArgTypes{},
            ReturnType: TypeTimestamp,
            impure:     true,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {
                return MakeDTimestamp(timeutil.Now(), time.Microsecond), nil
            },
        },
    },

    "extract": {
        Builtin{
            Types:      ArgTypes{TypeString, TypeTimestamp},
            ReturnType: TypeInt,
            category:   categoryDateAndTime,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {

                fromTime := *args[1].(*DTimestamp)
                timeSpan := strings.ToLower(string(*args[0].(*DString)))
                switch timeSpan {
                case "year", "years":
                    return NewDInt(DInt(fromTime.Year())), nil

                case "quarter":
                    return NewDInt(DInt(fromTime.Month()/4 + 1)), nil

                case "month", "months":
                    return NewDInt(DInt(fromTime.Month())), nil

                case "week", "weeks":
                    _, week := fromTime.ISOWeek()
                    return NewDInt(DInt(week)), nil

                case "day", "days":
                    return NewDInt(DInt(fromTime.Day())), nil

                case "dayofweek", "dow":
                    return NewDInt(DInt(fromTime.Weekday())), nil

                case "dayofyear", "doy":
                    return NewDInt(DInt(fromTime.YearDay())), nil

                case "hour", "hours":
                    return NewDInt(DInt(fromTime.Hour())), nil

                case "minute", "minutes":
                    return NewDInt(DInt(fromTime.Minute())), nil

                case "second", "seconds":
                    return NewDInt(DInt(fromTime.Second())), nil

                case "millisecond", "milliseconds":

                    return NewDInt(DInt(fromTime.Nanosecond() / int(time.Millisecond))), nil

                case "microsecond", "microseconds":
                    return NewDInt(DInt(fromTime.Nanosecond() / int(time.Microsecond))), nil

                case "nanosecond", "nanoseconds":

                    return NewDInt(DInt(fromTime.Nanosecond())), nil

                case "epoch_nanosecond", "epoch_nanoseconds":

                    return NewDInt(DInt(fromTime.UnixNano())), nil

                case "epoch":
                    return NewDInt(DInt(fromTime.Unix())), nil

                default:
                    return DNull, fmt.Errorf("unsupported timespan: %s", timeSpan)
                }
            },
        },
    },

    "parse_timestamp_ns": {
        Builtin{
            Types:      ArgTypes{TypeString},
            ReturnType: TypeTimestamp,
            category:   categoryDateAndTime,
            fn: func(ctx *EvalContext, args DTuple) (Datum, error) {
                s := string(*args[0].(*DString))
                return ParseDTimestamp(s, ctx.GetLocation(), time.Nanosecond)
            },
        },
    },

    "format_timestamp_ns": {
        Builtin{
            Types:      ArgTypes{TypeTimestamp},
            ReturnType: TypeString,
            fn: func(ctx *EvalContext, args DTuple) (Datum, error) {
                t := args[0].(*DTimestamp)
                return NewDString(t.Time.UTC().Format(timestampFormatNS)), nil
            },
        },
    },

    "current_timestamp_ns": {
        Builtin{
            Types:      ArgTypes{},
            ReturnType: TypeTimestamp,
            impure:     true,
            fn: func(ctx *EvalContext, args DTuple) (Datum, error) {
                return ctx.GetTxnTimestamp(time.Nanosecond), nil
            },
        },
    },

    "abs": {
        floatBuiltin1(func(x float64) (Datum, error) {
            return NewDFloat(DFloat(math.Abs(x))), nil
        }),
        decimalBuiltin1(func(x *inf.Dec) (Datum, error) {
            dd := &DDecimal{}
            dd.Abs(x)
            return dd, nil
        }),
        Builtin{
            Types:      ArgTypes{TypeInt},
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {
                x := *args[0].(*DInt)
                switch {
                case x == math.MinInt64:
                    return DNull, errAbsOfMinInt64
                case x < 0:
                    return NewDInt(-x), nil
                }
                return args[0], nil
            },
        },
    },

    "acos": {
        floatBuiltin1(func(x float64) (Datum, error) {
            return NewDFloat(DFloat(math.Acos(x))), nil
        }),
    },

    "asin": {
        floatBuiltin1(func(x float64) (Datum, error) {
            return NewDFloat(DFloat(math.Asin(x))), nil
        }),
    },

    "atan": {
        floatBuiltin1(func(x float64) (Datum, error) {
            return NewDFloat(DFloat(math.Atan(x))), nil
        }),
    },

    "atan2": {
        floatBuiltin2(func(x, y float64) (Datum, error) {
            return NewDFloat(DFloat(math.Atan2(x, y))), nil
        }),
    },

    "cbrt": {
        floatBuiltin1(func(x float64) (Datum, error) {
            return NewDFloat(DFloat(math.Cbrt(x))), nil
        }),
        decimalBuiltin1(func(x *inf.Dec) (Datum, error) {
            dd := &DDecimal{}
            decimal.Cbrt(&dd.Dec, x, decimal.Precision)
            return dd, nil
        }),
    },

    "ceil":    ceilImpl,
    "ceiling": ceilImpl,

    "cos": {
        floatBuiltin1(func(x float64) (Datum, error) {
            return NewDFloat(DFloat(math.Cos(x))), nil
        }),
    },

    "cot": {
        floatBuiltin1(func(x float64) (Datum, error) {
            return NewDFloat(DFloat(1 / math.Tan(x))), nil
        }),
    },

    "degrees": {
        floatBuiltin1(func(x float64) (Datum, error) {
            return NewDFloat(DFloat(180.0 * x / math.Pi)), nil
        }),
    },

    "div": {
        floatBuiltin2(func(x, y float64) (Datum, error) {
            return NewDFloat(DFloat(math.Trunc(x / y))), nil
        }),
        decimalBuiltin2(func(x, y *inf.Dec) (Datum, error) {
            if y.Sign() == 0 {
                return nil, errDivByZero
            }
            dd := &DDecimal{}
            dd.QuoRound(x, y, 0, inf.RoundDown)
            return dd, nil
        }),
    },

    "exp": {
        floatBuiltin1(func(x float64) (Datum, error) {
            return NewDFloat(DFloat(math.Exp(x))), nil
        }),
        decimalBuiltin1(func(x *inf.Dec) (Datum, error) {
            dd := &DDecimal{}
            decimal.Exp(&dd.Dec, x, decimal.Precision)
            return dd, nil
        }),
    },

    "floor": {
        floatBuiltin1(func(x float64) (Datum, error) {
            return NewDFloat(DFloat(math.Floor(x))), nil
        }),
        decimalBuiltin1(func(x *inf.Dec) (Datum, error) {
            dd := &DDecimal{}
            dd.Round(x, 0, inf.RoundFloor)
            return dd, nil
        }),
    },

    "ln": {
        floatBuiltin1(func(x float64) (Datum, error) {
            return NewDFloat(DFloat(math.Log(x))), nil
        }),
        decimalLogFn(decimal.Log),
    },

    "log": {
        floatBuiltin1(func(x float64) (Datum, error) {
            return NewDFloat(DFloat(math.Log10(x))), nil
        }),
        decimalLogFn(decimal.Log10),
    },

    "mod": {
        floatBuiltin2(func(x, y float64) (Datum, error) {
            return NewDFloat(DFloat(math.Mod(x, y))), nil
        }),
        decimalBuiltin2(func(x, y *inf.Dec) (Datum, error) {
            if y.Sign() == 0 {
                return nil, errZeroModulus
            }
            dd := &DDecimal{}
            decimal.Mod(&dd.Dec, x, y)
            return dd, nil
        }),
        Builtin{
            Types:      ArgTypes{TypeInt, TypeInt},
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {
                y := *args[1].(*DInt)
                if y == 0 {
                    return DNull, errZeroModulus
                }
                x := *args[0].(*DInt)
                return NewDInt(x % y), nil
            },
        },
    },

    "pi": {
        Builtin{
            Types:      ArgTypes{},
            ReturnType: TypeFloat,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {
                return NewDFloat(math.Pi), nil
            },
        },
    },

    "pow":   powImpls,
    "power": powImpls,

    "radians": {
        floatBuiltin1(func(x float64) (Datum, error) {
            return NewDFloat(DFloat(x * math.Pi / 180.0)), nil
        }),
    },

    "round": {
        floatBuiltin1(func(x float64) (Datum, error) {
            return round(x, 0)
        }),
        decimalBuiltin1(func(x *inf.Dec) (Datum, error) {
            dd := &DDecimal{}
            dd.Round(x, 0, inf.RoundHalfUp)
            return dd, nil
        }),
        Builtin{
            Types:      ArgTypes{TypeFloat, TypeInt},
            ReturnType: TypeFloat,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {
                return round(float64(*args[0].(*DFloat)), int64(*args[1].(*DInt)))
            },
        },
        Builtin{
            Types:      ArgTypes{TypeDecimal, TypeInt},
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {
                dec := &args[0].(*DDecimal).Dec
                dd := &DDecimal{}
                dd.Round(dec, inf.Scale(*args[1].(*DInt)), inf.RoundHalfUp)
                return dd, nil
            },
        },
    },

    "sin": {
        floatBuiltin1(func(x float64) (Datum, error) {
            return NewDFloat(DFloat(math.Sin(x))), nil
        }),
    },

    "sign": {
        floatBuiltin1(func(x float64) (Datum, error) {
            switch {
            case x < 0:
                return NewDFloat(-1), nil
            case x == 0:
                return NewDFloat(0), nil
            }
            return NewDFloat(1), nil
        }),
        decimalBuiltin1(func(x *inf.Dec) (Datum, error) {
            return NewDFloat(DFloat(x.Sign())), nil
        }),
        Builtin{
            Types:      ArgTypes{TypeInt},
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {
                x := *args[0].(*DInt)
                switch {
                case x < 0:
                    return NewDInt(-1), nil
                case x == 0:
                    return NewDInt(0), nil
                }
                return NewDInt(1), nil
            },
        },
    },

    "sqrt": {
        floatBuiltin1(func(x float64) (Datum, error) {
            if x < 0 {
                return nil, errSqrtOfNegNumber
            }
            return NewDFloat(DFloat(math.Sqrt(x))), nil
        }),
        decimalBuiltin1(func(x *inf.Dec) (Datum, error) {
            if x.Sign() < 0 {
                return nil, errSqrtOfNegNumber
            }
            dd := &DDecimal{}
            decimal.Sqrt(&dd.Dec, x, decimal.Precision)
            return dd, nil
        }),
    },

    "tan": {
        floatBuiltin1(func(x float64) (Datum, error) {
            return NewDFloat(DFloat(math.Tan(x))), nil
        }),
    },

    "trunc": {
        floatBuiltin1(func(x float64) (Datum, error) {
            return NewDFloat(DFloat(math.Trunc(x))), nil
        }),
        decimalBuiltin1(func(x *inf.Dec) (Datum, error) {
            dd := &DDecimal{}
            dd.Round(x, 0, inf.RoundDown)
            return dd, nil
        }),
    },
    "version": {
        Builtin{
            Types:      ArgTypes{},
            ReturnType: TypeString,
            category:   categorySystemInfo,
            fn: func(_ *EvalContext, args DTuple) (Datum, error) {
                return NewDString(build.GetInfo().Short()), nil
            },
        },
    },
}

Builtins contains the built-in functions indexed by name.

var CmpOps = map[ComparisonOperator]cmpOpOverload{
    EQ: {
        CmpOp{
            LeftType:  TypeString,
            RightType: TypeString,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(*left.(*DString) == *right.(*DString)), nil
            },
        },
        CmpOp{
            LeftType:  TypeBytes,
            RightType: TypeBytes,

            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(*left.(*DBytes) == *right.(*DBytes)), nil
            },
        },
        CmpOp{
            LeftType:  TypeBool,
            RightType: TypeBool,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(*left.(*DBool) == *right.(*DBool)), nil
            },
        },
        CmpOp{
            LeftType:  TypeInt,
            RightType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(*left.(*DInt) == *right.(*DInt)), nil
            },
        },
        CmpOp{
            LeftType:  TypeFloat,
            RightType: TypeFloat,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(*left.(*DFloat) == *right.(*DFloat)), nil
            },
        },
        CmpOp{
            LeftType:  TypeDecimal,
            RightType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                l := &left.(*DDecimal).Dec
                r := &right.(*DDecimal).Dec
                return DBool(l.Cmp(r) == 0), nil
            },
        },
        CmpOp{
            LeftType:  TypeFloat,
            RightType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(*left.(*DFloat) == DFloat(*right.(*DInt))), nil
            },
        },
        CmpOp{
            LeftType:  TypeInt,
            RightType: TypeFloat,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(DFloat(*left.(*DInt)) == *right.(*DFloat)), nil
            },
        },
        CmpOp{
            LeftType:  TypeDecimal,
            RightType: TypeInt,
            fn: func(ctx *EvalContext, left Datum, right Datum) (DBool, error) {
                l := &left.(*DDecimal).Dec
                r := ctx.getTmpDec().SetUnscaled(int64(*right.(*DInt))).SetScale(0)
                return DBool(l.Cmp(r) == 0), nil
            },
        },
        CmpOp{
            LeftType:  TypeInt,
            RightType: TypeDecimal,
            fn: func(ctx *EvalContext, left Datum, right Datum) (DBool, error) {
                l := ctx.getTmpDec().SetUnscaled(int64(*left.(*DInt))).SetScale(0)
                r := &right.(*DDecimal).Dec
                return DBool(l.Cmp(r) == 0), nil
            },
        },
        CmpOp{
            LeftType:  TypeDecimal,
            RightType: TypeFloat,
            fn: func(ctx *EvalContext, left Datum, right Datum) (DBool, error) {
                l := &left.(*DDecimal).Dec
                r := decimal.SetFromFloat(ctx.getTmpDec(), float64(*right.(*DFloat)))
                return DBool(l.Cmp(r) == 0), nil
            },
        },
        CmpOp{
            LeftType:  TypeFloat,
            RightType: TypeDecimal,
            fn: func(ctx *EvalContext, left Datum, right Datum) (DBool, error) {
                l := decimal.SetFromFloat(ctx.getTmpDec(), float64(*left.(*DFloat)))
                r := &right.(*DDecimal).Dec
                return DBool(l.Cmp(r) == 0), nil
            },
        },
        CmpOp{
            LeftType:  TypeDate,
            RightType: TypeDate,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(*left.(*DDate) == *right.(*DDate)), nil
            },
        },
        CmpOp{
            LeftType:  TypeTimestamp,
            RightType: TypeTimestamp,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(left.(*DTimestamp).Equal(right.(*DTimestamp).Time)), nil
            },
        },
        CmpOp{
            LeftType:  TypeTimestampTZ,
            RightType: TypeTimestampTZ,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(left.(*DTimestampTZ).Equal(right.(*DTimestampTZ).Time)), nil
            },
        },
        CmpOp{
            LeftType:  TypeInterval,
            RightType: TypeInterval,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(*left.(*DInterval) == *right.(*DInterval)), nil
            },
        },
        CmpOp{
            LeftType:  TypeTuple,
            RightType: TypeTuple,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                c, err := cmpTuple(left, right)
                return DBool(c == 0), err
            },
        },
    },

    LT: {
        CmpOp{
            LeftType:  TypeString,
            RightType: TypeString,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(*left.(*DString) < *right.(*DString)), nil
            },
        },
        CmpOp{
            LeftType:  TypeBytes,
            RightType: TypeBytes,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(*left.(*DBytes) < *right.(*DBytes)), nil
            },
        },
        CmpOp{
            LeftType:  TypeBool,
            RightType: TypeBool,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(!*left.(*DBool) && *right.(*DBool)), nil
            },
        },
        CmpOp{
            LeftType:  TypeInt,
            RightType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(*left.(*DInt) < *right.(*DInt)), nil
            },
        },
        CmpOp{
            LeftType:  TypeFloat,
            RightType: TypeFloat,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(*left.(*DFloat) < *right.(*DFloat)), nil
            },
        },
        CmpOp{
            LeftType:  TypeDecimal,
            RightType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                l := &left.(*DDecimal).Dec
                r := &right.(*DDecimal).Dec
                return DBool(l.Cmp(r) < 0), nil
            },
        },
        CmpOp{
            LeftType:  TypeFloat,
            RightType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(*left.(*DFloat) < DFloat(*right.(*DInt))), nil
            },
        },
        CmpOp{
            LeftType:  TypeInt,
            RightType: TypeFloat,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(DFloat(*left.(*DInt)) < *right.(*DFloat)), nil
            },
        },
        CmpOp{
            LeftType:  TypeDecimal,
            RightType: TypeInt,
            fn: func(ctx *EvalContext, left Datum, right Datum) (DBool, error) {
                l := &left.(*DDecimal).Dec
                r := ctx.getTmpDec().SetUnscaled(int64(*right.(*DInt))).SetScale(0)
                return DBool(l.Cmp(r) < 0), nil
            },
        },
        CmpOp{
            LeftType:  TypeInt,
            RightType: TypeDecimal,
            fn: func(ctx *EvalContext, left Datum, right Datum) (DBool, error) {
                l := ctx.getTmpDec().SetUnscaled(int64(*left.(*DInt))).SetScale(0)
                r := &right.(*DDecimal).Dec
                return DBool(l.Cmp(r) < 0), nil
            },
        },
        CmpOp{
            LeftType:  TypeDecimal,
            RightType: TypeFloat,
            fn: func(ctx *EvalContext, left Datum, right Datum) (DBool, error) {
                l := &left.(*DDecimal).Dec
                r := decimal.SetFromFloat(ctx.getTmpDec(), float64(*right.(*DFloat)))
                return DBool(l.Cmp(r) < 0), nil
            },
        },
        CmpOp{
            LeftType:  TypeFloat,
            RightType: TypeDecimal,
            fn: func(ctx *EvalContext, left Datum, right Datum) (DBool, error) {
                l := decimal.SetFromFloat(ctx.getTmpDec(), float64(*left.(*DFloat)))
                r := &right.(*DDecimal).Dec
                return DBool(l.Cmp(r) < 0), nil
            },
        },
        CmpOp{
            LeftType:  TypeDate,
            RightType: TypeDate,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(*left.(*DDate) < *right.(*DDate)), nil
            },
        },
        CmpOp{
            LeftType:  TypeTimestamp,
            RightType: TypeTimestamp,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(left.(*DTimestamp).Before(right.(*DTimestamp).Time)), nil
            },
        },
        CmpOp{
            LeftType:  TypeTimestampTZ,
            RightType: TypeTimestampTZ,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(left.(*DTimestampTZ).Before(right.(*DTimestampTZ).Time)), nil
            },
        },
        CmpOp{
            LeftType:  TypeInterval,
            RightType: TypeInterval,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(left.(*DInterval).Duration.Compare(right.(*DInterval).Duration) < 0), nil
            },
        },
        CmpOp{
            LeftType:  TypeTuple,
            RightType: TypeTuple,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                c, err := cmpTuple(left, right)
                return DBool(c < 0), err
            },
        },
    },

    LE: {
        CmpOp{
            LeftType:  TypeString,
            RightType: TypeString,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(*left.(*DString) <= *right.(*DString)), nil
            },
        },
        CmpOp{
            LeftType:  TypeBytes,
            RightType: TypeBytes,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(*left.(*DBytes) <= *right.(*DBytes)), nil
            },
        },
        CmpOp{
            LeftType:  TypeBool,
            RightType: TypeBool,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(!*left.(*DBool) || *right.(*DBool)), nil
            },
        },
        CmpOp{
            LeftType:  TypeInt,
            RightType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(*left.(*DInt) <= *right.(*DInt)), nil
            },
        },
        CmpOp{
            LeftType:  TypeFloat,
            RightType: TypeFloat,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(*left.(*DFloat) <= *right.(*DFloat)), nil
            },
        },
        CmpOp{
            LeftType:  TypeDecimal,
            RightType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                l := &left.(*DDecimal).Dec
                r := &right.(*DDecimal).Dec
                return DBool(l.Cmp(r) <= 0), nil
            },
        },
        CmpOp{
            LeftType:  TypeFloat,
            RightType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(*left.(*DFloat) <= DFloat(*right.(*DInt))), nil
            },
        },
        CmpOp{
            LeftType:  TypeInt,
            RightType: TypeFloat,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(DFloat(*left.(*DInt)) <= *right.(*DFloat)), nil
            },
        },
        CmpOp{
            LeftType:  TypeDecimal,
            RightType: TypeInt,
            fn: func(ctx *EvalContext, left Datum, right Datum) (DBool, error) {
                l := &left.(*DDecimal).Dec
                r := ctx.getTmpDec().SetUnscaled(int64(*right.(*DInt))).SetScale(0)
                return DBool(l.Cmp(r) <= 0), nil
            },
        },
        CmpOp{
            LeftType:  TypeInt,
            RightType: TypeDecimal,
            fn: func(ctx *EvalContext, left Datum, right Datum) (DBool, error) {
                l := ctx.getTmpDec().SetUnscaled(int64(*left.(*DInt))).SetScale(0)
                r := &right.(*DDecimal).Dec
                return DBool(l.Cmp(r) <= 0), nil
            },
        },
        CmpOp{
            LeftType:  TypeDecimal,
            RightType: TypeFloat,
            fn: func(ctx *EvalContext, left Datum, right Datum) (DBool, error) {
                l := &left.(*DDecimal).Dec
                r := decimal.SetFromFloat(ctx.getTmpDec(), float64(*right.(*DFloat)))
                return DBool(l.Cmp(r) <= 0), nil
            },
        },
        CmpOp{
            LeftType:  TypeFloat,
            RightType: TypeDecimal,
            fn: func(ctx *EvalContext, left Datum, right Datum) (DBool, error) {
                l := decimal.SetFromFloat(ctx.getTmpDec(), float64(*left.(*DFloat)))
                r := &right.(*DDecimal).Dec
                return DBool(l.Cmp(r) <= 0), nil
            },
        },
        CmpOp{
            LeftType:  TypeDate,
            RightType: TypeDate,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(*left.(*DDate) <= *right.(*DDate)), nil
            },
        },
        CmpOp{
            LeftType:  TypeTimestamp,
            RightType: TypeTimestamp,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return !DBool(right.(*DTimestamp).Before(left.(*DTimestamp).Time)), nil
            },
        },
        CmpOp{
            LeftType:  TypeTimestampTZ,
            RightType: TypeTimestampTZ,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return !DBool(right.(*DTimestampTZ).Before(left.(*DTimestampTZ).Time)), nil
            },
        },
        CmpOp{
            LeftType:  TypeInterval,
            RightType: TypeInterval,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                return DBool(left.(*DInterval).Duration.Compare(right.(*DInterval).Duration) <= 0), nil
            },
        },
        CmpOp{
            LeftType:  TypeTuple,
            RightType: TypeTuple,
            fn: func(_ *EvalContext, left Datum, right Datum) (DBool, error) {
                c, err := cmpTuple(left, right)
                return DBool(c <= 0), err
            },
        },
    },

    In: {
        makeEvalTupleIn(TypeBool),
        makeEvalTupleIn(TypeInt),
        makeEvalTupleIn(TypeFloat),
        makeEvalTupleIn(TypeDecimal),
        makeEvalTupleIn(TypeString),
        makeEvalTupleIn(TypeBytes),
        makeEvalTupleIn(TypeDate),
        makeEvalTupleIn(TypeTimestamp),
        makeEvalTupleIn(TypeTimestampTZ),
        makeEvalTupleIn(TypeInterval),
        makeEvalTupleIn(TypeTuple),
    },

    Like: {
        CmpOp{
            LeftType:  TypeString,
            RightType: TypeString,
            fn: func(ctx *EvalContext, left Datum, right Datum) (DBool, error) {
                return matchLike(ctx, left, right, false)
            },
        },
    },

    ILike: {
        CmpOp{
            LeftType:  TypeString,
            RightType: TypeString,
            fn: func(ctx *EvalContext, left Datum, right Datum) (DBool, error) {
                return matchLike(ctx, left, right, true)
            },
        },
    },

    SimilarTo: {
        CmpOp{
            LeftType:  TypeString,
            RightType: TypeString,
            fn: func(ctx *EvalContext, left Datum, right Datum) (DBool, error) {
                key := similarToKey(*right.(*DString))
                return matchRegexpWithKey(ctx, left, key)
            },
        },
    },

    RegMatch: {
        CmpOp{
            LeftType:  TypeString,
            RightType: TypeString,
            fn: func(ctx *EvalContext, left Datum, right Datum) (DBool, error) {
                key := regexpKey{s: string(*right.(*DString)), caseInsensitive: false}
                return matchRegexpWithKey(ctx, left, key)
            },
        },
    },

    RegIMatch: {
        CmpOp{
            LeftType:  TypeString,
            RightType: TypeString,
            fn: func(ctx *EvalContext, left Datum, right Datum) (DBool, error) {
                key := regexpKey{s: string(*right.(*DString)), caseInsensitive: true}
                return matchRegexpWithKey(ctx, left, key)
            },
        },
    },
}

CmpOps contains the comparison operations indexed by operation type.

var NoTypePreference = Datum(nil)

NoTypePreference can be provided to TypeCheck's desired type parameter to indicate that the caller of the function has no preference on the type of the resulting TypedExpr.

var UnaryOps = map[UnaryOperator]unaryOpOverload{
    UnaryPlus: {
        UnaryOp{
            Typ:        TypeInt,
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, d Datum) (Datum, error) {
                return d, nil
            },
        },
        UnaryOp{
            Typ:        TypeFloat,
            ReturnType: TypeFloat,
            fn: func(_ *EvalContext, d Datum) (Datum, error) {
                return d, nil
            },
        },
        UnaryOp{
            Typ:        TypeDecimal,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, d Datum) (Datum, error) {
                return d, nil
            },
        },
    },

    UnaryMinus: {
        UnaryOp{
            Typ:        TypeInt,
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, d Datum) (Datum, error) {
                return NewDInt(-*d.(*DInt)), nil
            },
        },
        UnaryOp{
            Typ:        TypeFloat,
            ReturnType: TypeFloat,
            fn: func(_ *EvalContext, d Datum) (Datum, error) {
                return NewDFloat(-*d.(*DFloat)), nil
            },
        },
        UnaryOp{
            Typ:        TypeDecimal,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, d Datum) (Datum, error) {
                dec := &d.(*DDecimal).Dec
                dd := &DDecimal{}
                dd.Neg(dec)
                return dd, nil
            },
        },
    },

    UnaryComplement: {
        UnaryOp{
            Typ:        TypeInt,
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, d Datum) (Datum, error) {
                return NewDInt(^*d.(*DInt)), nil
            },
        },
    },
}

UnaryOps contains the unary operations indexed by operation type.

func AsString Uses

func AsString(n NodeFormatter) string

AsString pretty prints a node to a string.

func AsStringWithFlags Uses

func AsStringWithFlags(n NodeFormatter, f FmtFlags) string

AsStringWithFlags pretty prints a node to a string given specific flags.

func ContainsVars Uses

func ContainsVars(expr Expr) bool

ContainsVars returns true if the expression contains any variables.

func FindEqualComparisonFunction Uses

func FindEqualComparisonFunction(leftType, rightType Datum) (func(*EvalContext, Datum, Datum) (DBool, error), bool)

FindEqualComparisonFunction looks up an overload of the "=" operator for a given pair of input operand types.

func FormatNode Uses

func FormatNode(buf *bytes.Buffer, f FmtFlags, n NodeFormatter)

FormatNode recurses into a node for pretty-printing. Flag-driven special cases can hook into this.

func IsNumericOne Uses

func IsNumericOne(expr TypedExpr) bool

IsNumericOne returns true if the datum is a number and equal to one.

func IsNumericZero Uses

func IsNumericZero(expr TypedExpr) bool

IsNumericZero returns true if the datum is a number and equal to zero.

func SimilarEscape Uses

func SimilarEscape(pattern string) string

SimilarEscape converts a SQL:2008 regexp pattern to POSIX style, so it can be used by our regexp engine.

func ValidateRestartCheckpoint Uses

func ValidateRestartCheckpoint(savepoint string) error

ValidateRestartCheckpoint checks that a checkpoint name is our magic restart value. We accept everything with the desired prefix because at least the C++ libpqxx appends sequence numbers to the savepoint name specified by the user.

func WalkExprConst Uses

func WalkExprConst(v Visitor, expr Expr)

WalkExprConst is a variant of WalkExpr for visitors that do not modify the expression.

type AggregateFunc Uses

type AggregateFunc interface {
    Add(Datum) error
    Result() (Datum, error)
}

AggregateFunc accumulates the result of a some function of a Datum.

func NewIdentAggregate Uses

func NewIdentAggregate() AggregateFunc

NewIdentAggregate returns an identAggregate (see comment on struct).

type AliasClause Uses

type AliasClause struct {
    Alias Name
    Cols  NameList
}

AliasClause represents an alias, optionally with a column list: "AS name" or "AS name(col1, col2)".

func (AliasClause) Format Uses

func (a AliasClause) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type AliasedTableExpr Uses

type AliasedTableExpr struct {
    Expr  TableExpr
    Hints *IndexHints
    As    AliasClause
    AsOf  AsOfClause
}

AliasedTableExpr represents a table expression coupled with an optional alias.

func (*AliasedTableExpr) Format Uses

func (node *AliasedTableExpr) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*AliasedTableExpr) String Uses

func (node *AliasedTableExpr) String() string

type AlterTable Uses

type AlterTable struct {
    IfExists bool
    Table    *QualifiedName
    Cmds     AlterTableCmds
}

AlterTable represents an ALTER TABLE statement.

func (*AlterTable) Format Uses

func (node *AlterTable) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*AlterTable) StatementTag Uses

func (*AlterTable) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*AlterTable) StatementType Uses

func (*AlterTable) StatementType() StatementType

StatementType implements the Statement interface.

func (*AlterTable) String Uses

func (n *AlterTable) String() string

type AlterTableAddColumn Uses

type AlterTableAddColumn struct {
    IfNotExists bool
    ColumnDef   *ColumnTableDef
    // contains filtered or unexported fields
}

AlterTableAddColumn represents an ADD COLUMN command.

func (*AlterTableAddColumn) Format Uses

func (node *AlterTableAddColumn) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*AlterTableAddColumn) String Uses

func (n *AlterTableAddColumn) String() string

type AlterTableAddConstraint Uses

type AlterTableAddConstraint struct {
    ConstraintDef ConstraintTableDef
}

AlterTableAddConstraint represents an ADD CONSTRAINT command.

func (*AlterTableAddConstraint) Format Uses

func (node *AlterTableAddConstraint) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*AlterTableAddConstraint) String Uses

func (n *AlterTableAddConstraint) String() string

type AlterTableCmd Uses

type AlterTableCmd interface {
    NodeFormatter
    // contains filtered or unexported methods
}

AlterTableCmd represents a table modification operation.

type AlterTableCmds Uses

type AlterTableCmds []AlterTableCmd

AlterTableCmds represents a list of table alterations.

func (AlterTableCmds) Format Uses

func (node AlterTableCmds) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (AlterTableCmds) String Uses

func (n AlterTableCmds) String() string

type AlterTableDropColumn Uses

type AlterTableDropColumn struct {
    IfExists     bool
    Column       string
    DropBehavior DropBehavior
    // contains filtered or unexported fields
}

AlterTableDropColumn represents a DROP COLUMN command.

func (*AlterTableDropColumn) Format Uses

func (node *AlterTableDropColumn) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*AlterTableDropColumn) String Uses

func (n *AlterTableDropColumn) String() string

type AlterTableDropConstraint Uses

type AlterTableDropConstraint struct {
    IfExists     bool
    Constraint   string
    DropBehavior DropBehavior
}

AlterTableDropConstraint represents a DROP CONSTRAINT command.

func (*AlterTableDropConstraint) Format Uses

func (node *AlterTableDropConstraint) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*AlterTableDropConstraint) String Uses

func (n *AlterTableDropConstraint) String() string

type AlterTableDropNotNull Uses

type AlterTableDropNotNull struct {
    Column string
    // contains filtered or unexported fields
}

AlterTableDropNotNull represents an ALTER COLUMN DROP NOT NULL command.

func (*AlterTableDropNotNull) Format Uses

func (node *AlterTableDropNotNull) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*AlterTableDropNotNull) GetColumn Uses

func (node *AlterTableDropNotNull) GetColumn() string

GetColumn implements the ColumnMutationCmd interface.

func (*AlterTableDropNotNull) String Uses

func (n *AlterTableDropNotNull) String() string

type AlterTableSetDefault Uses

type AlterTableSetDefault struct {
    Column  string
    Default Expr
    // contains filtered or unexported fields
}

AlterTableSetDefault represents an ALTER COLUMN SET DEFAULT or DROP DEFAULT command.

func (*AlterTableSetDefault) Format Uses

func (node *AlterTableSetDefault) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*AlterTableSetDefault) GetColumn Uses

func (node *AlterTableSetDefault) GetColumn() string

GetColumn implements the ColumnMutationCmd interface.

func (*AlterTableSetDefault) String Uses

func (n *AlterTableSetDefault) String() string

type AndExpr Uses

type AndExpr struct {
    Left, Right Expr
    // contains filtered or unexported fields
}

AndExpr represents an AND expression.

func NewTypedAndExpr Uses

func NewTypedAndExpr(left, right TypedExpr) *AndExpr

NewTypedAndExpr returns a new AndExpr that is verified to be well-typed.

func (*AndExpr) Eval Uses

func (expr *AndExpr) Eval(ctx *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*AndExpr) Format Uses

func (node *AndExpr) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (AndExpr) ReturnType Uses

func (ta AndExpr) ReturnType() Datum

func (*AndExpr) String Uses

func (node *AndExpr) String() string

func (*AndExpr) TypeCheck Uses

func (expr *AndExpr) TypeCheck(ctx *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*AndExpr) TypedLeft Uses

func (node *AndExpr) TypedLeft() TypedExpr

TypedLeft returns the AndExpr's left expression as a TypedExpr.

func (*AndExpr) TypedRight Uses

func (node *AndExpr) TypedRight() TypedExpr

TypedRight returns the AndExpr's right expression as a TypedExpr.

func (*AndExpr) Walk Uses

func (expr *AndExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type AnnotateTypeExpr Uses

type AnnotateTypeExpr struct {
    Expr Expr
    Type ColumnType
    // contains filtered or unexported fields
}

AnnotateTypeExpr represents a ANNOTATE_TYPE(expr, type) expression.

func (*AnnotateTypeExpr) Eval Uses

func (expr *AnnotateTypeExpr) Eval(ctx *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*AnnotateTypeExpr) Format Uses

func (node *AnnotateTypeExpr) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (AnnotateTypeExpr) ReturnType Uses

func (ta AnnotateTypeExpr) ReturnType() Datum

func (*AnnotateTypeExpr) String Uses

func (node *AnnotateTypeExpr) String() string

func (*AnnotateTypeExpr) TypeCheck Uses

func (expr *AnnotateTypeExpr) TypeCheck(ctx *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*AnnotateTypeExpr) TypedInnerExpr Uses

func (node *AnnotateTypeExpr) TypedInnerExpr() TypedExpr

TypedInnerExpr returns the AnnotateTypeExpr's inner expression as a TypedExpr.

func (*AnnotateTypeExpr) Walk Uses

func (expr *AnnotateTypeExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type AnyType Uses

type AnyType struct{}

AnyType is a typeList implementation that accepts any arguments.

type ArgTypes Uses

type ArgTypes []Datum

ArgTypes is a typeList implementation that accepts a specific number of argument types.

type Array Uses

type Array struct {
    Exprs Exprs
}

Array represents an array constructor.

func (*Array) Format Uses

func (node *Array) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*Array) String Uses

func (node *Array) String() string

func (*Array) TypeCheck Uses

func (expr *Array) TypeCheck(_ *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*Array) Walk Uses

func (expr *Array) Walk(v Visitor) Expr

Walk implements the Expr interface.

type ArrayIndirection Uses

type ArrayIndirection struct {
    Begin Expr
    End   Expr
}

ArrayIndirection represents "[<begin>:<end>]" in an indirection expression.

func (*ArrayIndirection) Format Uses

func (a *ArrayIndirection) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type AsOfClause Uses

type AsOfClause struct {
    Expr Expr
}

AsOfClause represents an as of time.

func (AsOfClause) Format Uses

func (a AsOfClause) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type BeginTransaction Uses

type BeginTransaction struct {
    Isolation    IsolationLevel
    UserPriority UserPriority
}

BeginTransaction represents a BEGIN statement

func (*BeginTransaction) Format Uses

func (node *BeginTransaction) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*BeginTransaction) StatementTag Uses

func (*BeginTransaction) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*BeginTransaction) StatementType Uses

func (*BeginTransaction) StatementType() StatementType

StatementType implements the Statement interface.

func (*BeginTransaction) String Uses

func (n *BeginTransaction) String() string

type BinOp Uses

type BinOp struct {
    LeftType   Datum
    RightType  Datum
    ReturnType Datum
    // contains filtered or unexported fields
}

BinOp is a binary operator.

type BinaryExpr Uses

type BinaryExpr struct {
    Operator    BinaryOperator
    Left, Right Expr
    // contains filtered or unexported fields
}

BinaryExpr represents a binary value expression.

func (*BinaryExpr) Eval Uses

func (expr *BinaryExpr) Eval(ctx *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*BinaryExpr) Format Uses

func (node *BinaryExpr) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (BinaryExpr) ReturnType Uses

func (ta BinaryExpr) ReturnType() Datum

func (*BinaryExpr) String Uses

func (node *BinaryExpr) String() string

func (*BinaryExpr) TypeCheck Uses

func (expr *BinaryExpr) TypeCheck(ctx *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*BinaryExpr) TypedLeft Uses

func (node *BinaryExpr) TypedLeft() TypedExpr

TypedLeft returns the BinaryExpr's left expression as a TypedExpr.

func (*BinaryExpr) TypedRight Uses

func (node *BinaryExpr) TypedRight() TypedExpr

TypedRight returns the BinaryExpr's right expression as a TypedExpr.

func (*BinaryExpr) Walk Uses

func (expr *BinaryExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type BinaryOperator Uses

type BinaryOperator int

BinaryOperator represents a binary operator.

const (
    Bitand BinaryOperator = iota
    Bitor
    Bitxor
    Plus
    Minus
    Mult
    Div
    FloorDiv
    Mod
    Concat
    LShift
    RShift
)

BinaryExpr.Operator

func (BinaryOperator) String Uses

func (i BinaryOperator) String() string

type BoolColType Uses

type BoolColType struct {
    Name string
}

BoolColType represents a BOOLEAN type.

func (*BoolColType) Format Uses

func (node *BoolColType) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*BoolColType) String Uses

func (node *BoolColType) String() string

type Builtin Uses

type Builtin struct {
    Types      typeList
    ReturnType Datum

    AggregateFunc func() AggregateFunc
    // contains filtered or unexported fields
}

Builtin is a built-in function.

func (Builtin) Category Uses

func (b Builtin) Category() string

Category is used to categorize a function (for documentation purposes).

type BytesColType Uses

type BytesColType struct {
    Name string
}

BytesColType represents a BYTES or BLOB type.

func (*BytesColType) Format Uses

func (node *BytesColType) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*BytesColType) String Uses

func (node *BytesColType) String() string

type CaseExpr Uses

type CaseExpr struct {
    Expr  Expr
    Whens []*When
    Else  Expr
    // contains filtered or unexported fields
}

CaseExpr represents a CASE expression.

func (*CaseExpr) CopyNode Uses

func (expr *CaseExpr) CopyNode() *CaseExpr

CopyNode makes a copy of this Expr without recursing in any child Exprs.

func (*CaseExpr) Eval Uses

func (expr *CaseExpr) Eval(ctx *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*CaseExpr) Format Uses

func (node *CaseExpr) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (CaseExpr) ReturnType Uses

func (ta CaseExpr) ReturnType() Datum

func (*CaseExpr) String Uses

func (node *CaseExpr) String() string

func (*CaseExpr) TypeCheck Uses

func (expr *CaseExpr) TypeCheck(ctx *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*CaseExpr) Walk Uses

func (expr *CaseExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type CastExpr Uses

type CastExpr struct {
    Expr Expr
    Type ColumnType
    // contains filtered or unexported fields
}

CastExpr represents a CAST(expr AS type) expression.

func (*CastExpr) Eval Uses

func (expr *CastExpr) Eval(ctx *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*CastExpr) Format Uses

func (node *CastExpr) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (CastExpr) ReturnType Uses

func (ta CastExpr) ReturnType() Datum

func (*CastExpr) String Uses

func (node *CastExpr) String() string

func (*CastExpr) TypeCheck Uses

func (expr *CastExpr) TypeCheck(ctx *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*CastExpr) Walk Uses

func (expr *CastExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type CheckConstraintTableDef Uses

type CheckConstraintTableDef struct {
    Name Name
    Expr Expr
}

CheckConstraintTableDef represents a check constraint within a CREATE TABLE statement.

func (*CheckConstraintTableDef) Format Uses

func (node *CheckConstraintTableDef) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type CmpOp Uses

type CmpOp struct {
    LeftType  Datum
    RightType Datum
    // contains filtered or unexported fields
}

CmpOp is a comparison operator.

type CoalesceExpr Uses

type CoalesceExpr struct {
    Name  string
    Exprs Exprs
    // contains filtered or unexported fields
}

CoalesceExpr represents a COALESCE or IFNULL expression.

func (*CoalesceExpr) CopyNode Uses

func (expr *CoalesceExpr) CopyNode() *CoalesceExpr

CopyNode makes a copy of this Expr without recursing in any child Exprs.

func (*CoalesceExpr) Eval Uses

func (expr *CoalesceExpr) Eval(ctx *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*CoalesceExpr) Format Uses

func (node *CoalesceExpr) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (CoalesceExpr) ReturnType Uses

func (ta CoalesceExpr) ReturnType() Datum

func (*CoalesceExpr) String Uses

func (node *CoalesceExpr) String() string

func (*CoalesceExpr) TypeCheck Uses

func (expr *CoalesceExpr) TypeCheck(ctx *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*CoalesceExpr) TypedExprAt Uses

func (node *CoalesceExpr) TypedExprAt(idx int) TypedExpr

TypedExprAt returns the expression at the specified index as a TypedExpr.

func (*CoalesceExpr) Walk Uses

func (expr *CoalesceExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type ColumnCheckConstraint Uses

type ColumnCheckConstraint struct {
    Expr Expr
}

ColumnCheckConstraint represents either a check on a column.

type ColumnDefault Uses

type ColumnDefault struct {
    Expr Expr
}

ColumnDefault represents a DEFAULT clause for a column.

type ColumnFKConstraint Uses

type ColumnFKConstraint struct {
    Table *QualifiedName
    Col   Name // empty-string means use PK
}

ColumnFKConstraint represents a FK-constaint on a column.

type ColumnFamilyConstraint Uses

type ColumnFamilyConstraint struct {
    Family      Name
    Create      bool
    IfNotExists bool
}

ColumnFamilyConstraint represents FAMILY on a column.

type ColumnMutationCmd Uses

type ColumnMutationCmd interface {
    AlterTableCmd
    GetColumn() string
}

ColumnMutationCmd is the subset of AlterTableCmds that modify an existing column.

type ColumnQualification Uses

type ColumnQualification interface {
    // contains filtered or unexported methods
}

ColumnQualification represents a constraint on a column.

type ColumnTableDef Uses

type ColumnTableDef struct {
    Name     Name
    Type     ColumnType
    Nullable struct {
        Nullability    Nullability
        ConstraintName Name
    }
    PrimaryKey           bool
    Unique               bool
    UniqueConstraintName Name
    DefaultExpr          struct {
        Expr           Expr
        ConstraintName Name
    }
    CheckExpr struct {
        Expr           Expr
        ConstraintName Name
    }
    References struct {
        Table          *QualifiedName
        Col            Name
        ConstraintName Name
    }
    Family struct {
        Name        Name
        Create      bool
        IfNotExists bool
    }
}

ColumnTableDef represents a column definition within a CREATE TABLE statement.

func (*ColumnTableDef) Format Uses

func (node *ColumnTableDef) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type ColumnType Uses

type ColumnType interface {
    fmt.Stringer
    NodeFormatter
    // contains filtered or unexported methods
}

ColumnType represents a type in a column definition.

func DatumTypeToColumnType Uses

func DatumTypeToColumnType(d Datum) (ColumnType, error)

DatumTypeToColumnType produces a SQL column type equivalent to the given Datum type. Used to generate CastExpr nodes during normalization.

type CommitTransaction Uses

type CommitTransaction struct{}

CommitTransaction represents a COMMIT statement.

func (*CommitTransaction) Format Uses

func (node *CommitTransaction) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*CommitTransaction) StatementTag Uses

func (*CommitTransaction) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CommitTransaction) StatementType Uses

func (*CommitTransaction) StatementType() StatementType

StatementType implements the Statement interface.

func (*CommitTransaction) String Uses

func (n *CommitTransaction) String() string

type ComparisonExpr Uses

type ComparisonExpr struct {
    Operator    ComparisonOperator
    Left, Right Expr
    // contains filtered or unexported fields
}

ComparisonExpr represents a two-value comparison expression.

func NewTypedComparisonExpr Uses

func NewTypedComparisonExpr(op ComparisonOperator, left, right TypedExpr) *ComparisonExpr

NewTypedComparisonExpr returns a new ComparisonExpr that is verified to be well-typed.

func (*ComparisonExpr) Eval Uses

func (expr *ComparisonExpr) Eval(ctx *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*ComparisonExpr) Format Uses

func (node *ComparisonExpr) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*ComparisonExpr) IsMixedTypeComparison Uses

func (node *ComparisonExpr) IsMixedTypeComparison() bool

IsMixedTypeComparison returns true when the two sides of a comparison operator have different types.

func (ComparisonExpr) ReturnType Uses

func (ta ComparisonExpr) ReturnType() Datum

func (*ComparisonExpr) String Uses

func (node *ComparisonExpr) String() string

func (*ComparisonExpr) TypeCheck Uses

func (expr *ComparisonExpr) TypeCheck(ctx *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*ComparisonExpr) TypedLeft Uses

func (node *ComparisonExpr) TypedLeft() TypedExpr

TypedLeft returns the ComparisonExpr's left expression as a TypedExpr.

func (*ComparisonExpr) TypedRight Uses

func (node *ComparisonExpr) TypedRight() TypedExpr

TypedRight returns the ComparisonExpr's right expression as a TypedExpr.

func (*ComparisonExpr) Walk Uses

func (expr *ComparisonExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type ComparisonOperator Uses

type ComparisonOperator int

ComparisonOperator represents a binary operator.

const (
    EQ  ComparisonOperator = iota
    LT
    GT
    LE
    GE
    NE
    In
    NotIn
    Like
    NotLike
    ILike
    NotILike
    SimilarTo
    NotSimilarTo
    RegMatch
    NotRegMatch
    RegIMatch
    NotRegIMatch
    IsDistinctFrom
    IsNotDistinctFrom
    Is
    IsNot
)

ComparisonExpr.Operator

func (ComparisonOperator) String Uses

func (i ComparisonOperator) String() string

type Constant Uses

type Constant interface {
    Expr
    // AvailableTypes returns the ordered set of types that the Constant is able to
    // be resolved into. The order of the type slice provides a notion of precedence,
    // with the first element in the ordering being the Constant's "natural type".
    AvailableTypes() []Datum
    // ResolveAsType resolves the Constant as the Datum type specified, or returns an
    // error if the Constant could not be resolved as that type. The method should only
    // be passed a type returned from AvailableTypes and should never be called more than
    // once for a given Constant.
    ResolveAsType(*SemaContext, Datum) (Datum, error)
}

Constant is an constant literal expression which may be resolved to more than one type.

type ConstraintTableDef Uses

type ConstraintTableDef interface {
    TableDef
    // contains filtered or unexported methods
}

ConstraintTableDef represents a constraint definition within a CREATE TABLE statement.

type CreateDatabase Uses

type CreateDatabase struct {
    IfNotExists bool
    Name        Name
    Encoding    *StrVal
}

CreateDatabase represents a CREATE DATABASE statement.

func (*CreateDatabase) Format Uses

func (node *CreateDatabase) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*CreateDatabase) StatementTag Uses

func (*CreateDatabase) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CreateDatabase) StatementType Uses

func (*CreateDatabase) StatementType() StatementType

StatementType implements the Statement interface.

func (*CreateDatabase) String Uses

func (n *CreateDatabase) String() string

type CreateIndex Uses

type CreateIndex struct {
    Name        Name
    Table       *QualifiedName
    Unique      bool
    IfNotExists bool
    Columns     IndexElemList
    // Extra columns to be stored together with the indexed ones as an optimization
    // for improved reading performance.
    Storing    NameList
    Interleave *InterleaveDef
}

CreateIndex represents a CREATE INDEX statement.

func (*CreateIndex) Format Uses

func (node *CreateIndex) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*CreateIndex) StatementTag Uses

func (*CreateIndex) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CreateIndex) StatementType Uses

func (*CreateIndex) StatementType() StatementType

StatementType implements the Statement interface.

func (*CreateIndex) String Uses

func (n *CreateIndex) String() string

type CreateTable Uses

type CreateTable struct {
    IfNotExists bool
    Table       *QualifiedName
    Interleave  *InterleaveDef
    Defs        TableDefs
}

CreateTable represents a CREATE TABLE statement.

func (*CreateTable) Format Uses

func (node *CreateTable) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*CreateTable) StatementTag Uses

func (*CreateTable) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CreateTable) StatementType Uses

func (*CreateTable) StatementType() StatementType

StatementType implements the Statement interface.

func (*CreateTable) String Uses

func (n *CreateTable) String() string

type DBool Uses

type DBool bool

DBool is the boolean Datum.

func GetBool Uses

func GetBool(d Datum) (DBool, error)

GetBool gets DBool or an error (also treats NULL as false, not an error).

func MakeDBool Uses

func MakeDBool(d DBool) *DBool

MakeDBool converts its argument to a *DBool, returning either DBoolTrue or DBoolFalse.

func ParseDBool Uses

func ParseDBool(s string) (*DBool, error)

ParseDBool parses and returns the *DBool Datum value represented by the provided string, or an error if parsing is unsuccessful.

func (*DBool) Compare Uses

func (d *DBool) Compare(other Datum) int

Compare implements the Datum interface.

func (*DBool) Eval Uses

func (t *DBool) Eval(_ *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*DBool) Format Uses

func (d *DBool) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*DBool) HasNext Uses

func (*DBool) HasNext() bool

HasNext implements the Datum interface.

func (*DBool) HasPrev Uses

func (*DBool) HasPrev() bool

HasPrev implements the Datum interface.

func (*DBool) IsMax Uses

func (d *DBool) IsMax() bool

IsMax implements the Datum interface.

func (*DBool) IsMin Uses

func (d *DBool) IsMin() bool

IsMin implements the Datum interface.

func (*DBool) Next Uses

func (*DBool) Next() Datum

Next implements the Datum interface.

func (*DBool) Prev Uses

func (*DBool) Prev() Datum

Prev implements the Datum interface.

func (*DBool) ReturnType Uses

func (*DBool) ReturnType() Datum

ReturnType implements the TypedExpr interface.

func (*DBool) String Uses

func (node *DBool) String() string

func (*DBool) Type Uses

func (*DBool) Type() string

Type implements the Datum interface.

func (*DBool) TypeCheck Uses

func (d *DBool) TypeCheck(_ *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DBool) TypeEqual Uses

func (d *DBool) TypeEqual(other Datum) bool

TypeEqual implements the Datum interface.

func (*DBool) Walk Uses

func (expr *DBool) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DBytes Uses

type DBytes string

DBytes is the bytes Datum. The underlying type is a string because we want the immutability, but this may contain arbitrary bytes.

func NewDBytes Uses

func NewDBytes(d DBytes) *DBytes

NewDBytes is a helper routine to create a *DBytes initialized from its argument.

func (*DBytes) Compare Uses

func (d *DBytes) Compare(other Datum) int

Compare implements the Datum interface.

func (*DBytes) Eval Uses

func (t *DBytes) Eval(_ *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*DBytes) Format Uses

func (d *DBytes) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*DBytes) HasNext Uses

func (*DBytes) HasNext() bool

HasNext implements the Datum interface.

func (*DBytes) HasPrev Uses

func (*DBytes) HasPrev() bool

HasPrev implements the Datum interface.

func (*DBytes) IsMax Uses

func (*DBytes) IsMax() bool

IsMax implements the Datum interface.

func (*DBytes) IsMin Uses

func (d *DBytes) IsMin() bool

IsMin implements the Datum interface.

func (*DBytes) Next Uses

func (d *DBytes) Next() Datum

Next implements the Datum interface.

func (*DBytes) Prev Uses

func (d *DBytes) Prev() Datum

Prev implements the Datum interface.

func (*DBytes) ReturnType Uses

func (d *DBytes) ReturnType() Datum

ReturnType implements the TypedExpr interface.

func (*DBytes) String Uses

func (node *DBytes) String() string

func (*DBytes) Type Uses

func (*DBytes) Type() string

Type implements the Datum interface.

func (*DBytes) TypeCheck Uses

func (d *DBytes) TypeCheck(_ *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DBytes) TypeEqual Uses

func (d *DBytes) TypeEqual(other Datum) bool

TypeEqual implements the Datum interface.

func (*DBytes) Walk Uses

func (expr *DBytes) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DDate Uses

type DDate int64

DDate is the date Datum represented as the number of days after the Unix epoch.

func NewDDate Uses

func NewDDate(d DDate) *DDate

NewDDate is a helper routine to create a *DDate initialized from its argument.

func NewDDateFromTime Uses

func NewDDateFromTime(t time.Time, loc *time.Location) *DDate

NewDDateFromTime constructs a *DDate from a time.Time in the provided time zone.

func ParseDDate Uses

func ParseDDate(s string, loc *time.Location) (*DDate, error)

ParseDDate parses and returns the *DDate Datum value represented by the provided string in the provided location, or an error if parsing is unsuccessful.

func (*DDate) Compare Uses

func (d *DDate) Compare(other Datum) int

Compare implements the Datum interface.

func (*DDate) Eval Uses

func (t *DDate) Eval(_ *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*DDate) Format Uses

func (d *DDate) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*DDate) HasNext Uses

func (*DDate) HasNext() bool

HasNext implements the Datum interface.

func (*DDate) HasPrev Uses

func (*DDate) HasPrev() bool

HasPrev implements the Datum interface.

func (*DDate) IsMax Uses

func (d *DDate) IsMax() bool

IsMax implements the Datum interface.

func (*DDate) IsMin Uses

func (d *DDate) IsMin() bool

IsMin implements the Datum interface.

func (*DDate) Next Uses

func (d *DDate) Next() Datum

Next implements the Datum interface.

func (*DDate) Prev Uses

func (d *DDate) Prev() Datum

Prev implements the Datum interface.

func (*DDate) ReturnType Uses

func (*DDate) ReturnType() Datum

ReturnType implements the TypedExpr interface.

func (*DDate) String Uses

func (node *DDate) String() string

func (*DDate) Type Uses

func (*DDate) Type() string

Type implements the Datum interface.

func (*DDate) TypeCheck Uses

func (d *DDate) TypeCheck(_ *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DDate) TypeEqual Uses

func (d *DDate) TypeEqual(other Datum) bool

TypeEqual implements the Datum interface.

func (*DDate) Walk Uses

func (expr *DDate) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DDecimal Uses

type DDecimal struct {
    inf.Dec
}

DDecimal is the decimal Datum.

var DecimalOne DDecimal

DecimalOne represents the constant 1 as DECIMAL.

var DecimalZero DDecimal

DecimalZero represents the constant 0 as DECIMAL.

func ParseDDecimal Uses

func ParseDDecimal(s string) (*DDecimal, error)

ParseDDecimal parses and returns the *DDecimal Datum value represented by the provided string, or an error if parsing is unsuccessful.

func (*DDecimal) Compare Uses

func (d *DDecimal) Compare(other Datum) int

Compare implements the Datum interface.

func (*DDecimal) Eval Uses

func (t *DDecimal) Eval(_ *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*DDecimal) Format Uses

func (d *DDecimal) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*DDecimal) HasNext Uses

func (*DDecimal) HasNext() bool

HasNext implements the Datum interface.

func (*DDecimal) HasPrev Uses

func (*DDecimal) HasPrev() bool

HasPrev implements the Datum interface.

func (*DDecimal) IsMax Uses

func (*DDecimal) IsMax() bool

IsMax implements the Datum interface.

func (*DDecimal) IsMin Uses

func (*DDecimal) IsMin() bool

IsMin implements the Datum interface.

func (*DDecimal) Next Uses

func (d *DDecimal) Next() Datum

Next implements the Datum interface.

func (*DDecimal) Prev Uses

func (d *DDecimal) Prev() Datum

Prev implements the Datum interface.

func (*DDecimal) ReturnType Uses

func (d *DDecimal) ReturnType() Datum

ReturnType implements the TypedExpr interface.

func (*DDecimal) String Uses

func (node *DDecimal) String() string

func (*DDecimal) Type Uses

func (*DDecimal) Type() string

Type implements the Datum interface.

func (*DDecimal) TypeCheck Uses

func (d *DDecimal) TypeCheck(_ *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DDecimal) TypeEqual Uses

func (d *DDecimal) TypeEqual(other Datum) bool

TypeEqual implements the Datum interface.

func (*DDecimal) Walk Uses

func (expr *DDecimal) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DFloat Uses

type DFloat float64

DFloat is the float Datum.

func NewDFloat Uses

func NewDFloat(d DFloat) *DFloat

NewDFloat is a helper routine to create a *DFloat initialized from its argument.

func ParseDFloat Uses

func ParseDFloat(s string) (*DFloat, error)

ParseDFloat parses and returns the *DFloat Datum value represented by the provided string, or an error if parsing is unsuccessful.

func (*DFloat) Compare Uses

func (d *DFloat) Compare(other Datum) int

Compare implements the Datum interface.

func (*DFloat) Eval Uses

func (t *DFloat) Eval(_ *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*DFloat) Format Uses

func (d *DFloat) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*DFloat) HasNext Uses

func (*DFloat) HasNext() bool

HasNext implements the Datum interface.

func (*DFloat) HasPrev Uses

func (*DFloat) HasPrev() bool

HasPrev implements the Datum interface.

func (*DFloat) IsMax Uses

func (d *DFloat) IsMax() bool

IsMax implements the Datum interface.

func (*DFloat) IsMin Uses

func (d *DFloat) IsMin() bool

IsMin implements the Datum interface.

func (*DFloat) Next Uses

func (d *DFloat) Next() Datum

Next implements the Datum interface.

func (*DFloat) Prev Uses

func (d *DFloat) Prev() Datum

Prev implements the Datum interface.

func (*DFloat) ReturnType Uses

func (*DFloat) ReturnType() Datum

ReturnType implements the TypedExpr interface.

func (*DFloat) String Uses

func (node *DFloat) String() string

func (*DFloat) Type Uses

func (*DFloat) Type() string

Type implements the Datum interface.

func (*DFloat) TypeCheck Uses

func (d *DFloat) TypeCheck(_ *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DFloat) TypeEqual Uses

func (d *DFloat) TypeEqual(other Datum) bool

TypeEqual implements the Datum interface.

func (*DFloat) Walk Uses

func (expr *DFloat) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DInt Uses

type DInt int64

DInt is the int Datum.

func NewDInt Uses

func NewDInt(d DInt) *DInt

NewDInt is a helper routine to create a *DInt initialized from its argument.

func ParseDInt Uses

func ParseDInt(s string) (*DInt, error)

ParseDInt parses and returns the *DInt Datum value represented by the provided string, or an error if parsing is unsuccessful.

func (*DInt) Compare Uses

func (d *DInt) Compare(other Datum) int

Compare implements the Datum interface.

func (*DInt) Eval Uses

func (t *DInt) Eval(_ *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*DInt) Format Uses

func (d *DInt) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*DInt) HasNext Uses

func (*DInt) HasNext() bool

HasNext implements the Datum interface.

func (*DInt) HasPrev Uses

func (*DInt) HasPrev() bool

HasPrev implements the Datum interface.

func (*DInt) IsMax Uses

func (d *DInt) IsMax() bool

IsMax implements the Datum interface.

func (*DInt) IsMin Uses

func (d *DInt) IsMin() bool

IsMin implements the Datum interface.

func (*DInt) Next Uses

func (d *DInt) Next() Datum

Next implements the Datum interface.

func (*DInt) Prev Uses

func (d *DInt) Prev() Datum

Prev implements the Datum interface.

func (*DInt) ReturnType Uses

func (*DInt) ReturnType() Datum

ReturnType implements the TypedExpr interface.

func (*DInt) String Uses

func (node *DInt) String() string

func (*DInt) Type Uses

func (*DInt) Type() string

Type implements the Datum interface.

func (*DInt) TypeCheck Uses

func (d *DInt) TypeCheck(_ *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DInt) TypeEqual Uses

func (d *DInt) TypeEqual(other Datum) bool

TypeEqual implements the Datum interface.

func (*DInt) Walk Uses

func (expr *DInt) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DInterval Uses

type DInterval struct {
    duration.Duration
}

DInterval is the interval Datum.

func ParseDInterval Uses

func ParseDInterval(s string) (*DInterval, error)

ParseDInterval parses and returns the *DInterval Datum value represented by the provided string, or an error if parsing is unsuccessful.

func (*DInterval) Compare Uses

func (d *DInterval) Compare(other Datum) int

Compare implements the Datum interface.

func (*DInterval) Eval Uses

func (t *DInterval) Eval(_ *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*DInterval) Format Uses

func (d *DInterval) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*DInterval) HasNext Uses

func (*DInterval) HasNext() bool

HasNext implements the Datum interface.

func (*DInterval) HasPrev Uses

func (*DInterval) HasPrev() bool

HasPrev implements the Datum interface.

func (*DInterval) IsMax Uses

func (d *DInterval) IsMax() bool

IsMax implements the Datum interface.

func (*DInterval) IsMin Uses

func (d *DInterval) IsMin() bool

IsMin implements the Datum interface.

func (*DInterval) Next Uses

func (d *DInterval) Next() Datum

Next implements the Datum interface.

func (*DInterval) Prev Uses

func (d *DInterval) Prev() Datum

Prev implements the Datum interface.

func (*DInterval) ReturnType Uses

func (d *DInterval) ReturnType() Datum

ReturnType implements the TypedExpr interface.

func (*DInterval) String Uses

func (node *DInterval) String() string

func (*DInterval) Type Uses

func (*DInterval) Type() string

Type implements the Datum interface.

func (*DInterval) TypeCheck Uses

func (d *DInterval) TypeCheck(_ *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DInterval) TypeEqual Uses

func (d *DInterval) TypeEqual(other Datum) bool

TypeEqual implements the Datum interface.

func (*DInterval) Walk Uses

func (expr *DInterval) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DPlaceholder Uses

type DPlaceholder struct {
    // contains filtered or unexported fields
}

DPlaceholder is the named placeholder Datum.

func (*DPlaceholder) Compare Uses

func (d *DPlaceholder) Compare(other Datum) int

Compare implements the Datum interface.

func (*DPlaceholder) Eval Uses

func (t *DPlaceholder) Eval(_ *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*DPlaceholder) Format Uses

func (d *DPlaceholder) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*DPlaceholder) HasNext Uses

func (*DPlaceholder) HasNext() bool

HasNext implements the Datum interface.

func (*DPlaceholder) HasPrev Uses

func (*DPlaceholder) HasPrev() bool

HasPrev implements the Datum interface.

func (*DPlaceholder) IsMax Uses

func (*DPlaceholder) IsMax() bool

IsMax implements the Datum interface.

func (*DPlaceholder) IsMin Uses

func (*DPlaceholder) IsMin() bool

IsMin implements the Datum interface.

func (*DPlaceholder) Name Uses

func (d *DPlaceholder) Name() string

Name gives access to the placeholder's name to other packages.

func (*DPlaceholder) Next Uses

func (d *DPlaceholder) Next() Datum

Next implements the Datum interface.

func (*DPlaceholder) Prev Uses

func (d *DPlaceholder) Prev() Datum

Prev implements the Datum interface.

func (*DPlaceholder) ReturnType Uses

func (d *DPlaceholder) ReturnType() Datum

ReturnType implements the TypedExpr interface.

func (*DPlaceholder) String Uses

func (node *DPlaceholder) String() string

func (*DPlaceholder) Type Uses

func (*DPlaceholder) Type() string

Type implements the Datum interface.

func (*DPlaceholder) TypeCheck Uses

func (d *DPlaceholder) TypeCheck(_ *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DPlaceholder) TypeEqual Uses

func (d *DPlaceholder) TypeEqual(other Datum) bool

TypeEqual implements the Datum interface.

func (*DPlaceholder) Variable Uses

func (*DPlaceholder) Variable()

Variable implements the VariableExpr interface.

func (*DPlaceholder) Walk Uses

func (expr *DPlaceholder) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DString Uses

type DString string

DString is the string Datum.

func NewDString Uses

func NewDString(d string) *DString

NewDString is a helper routine to create a *DString initialized from its argument.

func (*DString) Compare Uses

func (d *DString) Compare(other Datum) int

Compare implements the Datum interface.

func (*DString) Eval Uses

func (t *DString) Eval(_ *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*DString) Format Uses

func (d *DString) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*DString) HasNext Uses

func (*DString) HasNext() bool

HasNext implements the Datum interface.

func (*DString) HasPrev Uses

func (*DString) HasPrev() bool

HasPrev implements the Datum interface.

func (*DString) IsMax Uses

func (*DString) IsMax() bool

IsMax implements the Datum interface.

func (*DString) IsMin Uses

func (d *DString) IsMin() bool

IsMin implements the Datum interface.

func (*DString) Next Uses

func (d *DString) Next() Datum

Next implements the Datum interface.

func (*DString) Prev Uses

func (d *DString) Prev() Datum

Prev implements the Datum interface.

func (*DString) ReturnType Uses

func (*DString) ReturnType() Datum

ReturnType implements the TypedExpr interface.

func (*DString) String Uses

func (node *DString) String() string

func (*DString) Type Uses

func (*DString) Type() string

Type implements the Datum interface.

func (*DString) TypeCheck Uses

func (d *DString) TypeCheck(_ *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DString) TypeEqual Uses

func (d *DString) TypeEqual(other Datum) bool

TypeEqual implements the Datum interface.

func (*DString) Walk Uses

func (expr *DString) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DTimestamp Uses

type DTimestamp struct {
    time.Time
}

DTimestamp is the timestamp Datum.

func MakeDTimestamp Uses

func MakeDTimestamp(t time.Time, precision time.Duration) *DTimestamp

MakeDTimestamp creates a DTimestamp with specified precision.

func ParseDTimestamp Uses

func ParseDTimestamp(s string, loc *time.Location, precision time.Duration) (*DTimestamp, error)

ParseDTimestamp parses and returns the *DTimestamp Datum value represented by the provided string in the provided location, or an error if parsing is unsuccessful.

func (*DTimestamp) Compare Uses

func (d *DTimestamp) Compare(other Datum) int

Compare implements the Datum interface.

func (*DTimestamp) Eval Uses

func (t *DTimestamp) Eval(_ *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*DTimestamp) Format Uses

func (d *DTimestamp) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*DTimestamp) HasNext Uses

func (*DTimestamp) HasNext() bool

HasNext implements the Datum interface.

func (*DTimestamp) HasPrev Uses

func (*DTimestamp) HasPrev() bool

HasPrev implements the Datum interface.

func (*DTimestamp) IsMax Uses

func (d *DTimestamp) IsMax() bool

IsMax implements the Datum interface.

func (*DTimestamp) IsMin Uses

func (d *DTimestamp) IsMin() bool

IsMin implements the Datum interface.

func (*DTimestamp) Next Uses

func (d *DTimestamp) Next() Datum

Next implements the Datum interface.

func (*DTimestamp) Prev Uses

func (d *DTimestamp) Prev() Datum

Prev implements the Datum interface.

func (*DTimestamp) ReturnType Uses

func (*DTimestamp) ReturnType() Datum

ReturnType implements the TypedExpr interface.

func (*DTimestamp) String Uses

func (node *DTimestamp) String() string

func (*DTimestamp) Type Uses

func (*DTimestamp) Type() string

Type implements the Datum interface.

func (*DTimestamp) TypeCheck Uses

func (d *DTimestamp) TypeCheck(_ *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DTimestamp) TypeEqual Uses

func (d *DTimestamp) TypeEqual(other Datum) bool

TypeEqual implements the Datum interface.

func (*DTimestamp) Walk Uses

func (expr *DTimestamp) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DTimestampTZ Uses

type DTimestampTZ struct {
    time.Time
}

DTimestampTZ is the timestamp Datum that is rendered with session offset.

func MakeDTimestampTZ Uses

func MakeDTimestampTZ(t time.Time, precision time.Duration) *DTimestampTZ

MakeDTimestampTZ creates a DTimestampTZ with specified precision.

func ParseDTimestampTZ Uses

func ParseDTimestampTZ(
    s string, loc *time.Location, precision time.Duration,
) (*DTimestampTZ, error)

ParseDTimestampTZ parses and returns the *DTimestampTZ Datum value represented by the provided string in the provided location, or an error if parsing is unsuccessful.

func (*DTimestampTZ) Compare Uses

func (d *DTimestampTZ) Compare(other Datum) int

Compare implements the Datum interface.

func (*DTimestampTZ) Eval Uses

func (t *DTimestampTZ) Eval(_ *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*DTimestampTZ) Format Uses

func (d *DTimestampTZ) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*DTimestampTZ) HasNext Uses

func (d *DTimestampTZ) HasNext() bool

HasNext implements the Datum interface.

func (*DTimestampTZ) HasPrev Uses

func (d *DTimestampTZ) HasPrev() bool

HasPrev implements the Datum interface.

func (*DTimestampTZ) IsMax Uses

func (d *DTimestampTZ) IsMax() bool

IsMax implements the Datum interface.

func (*DTimestampTZ) IsMin Uses

func (d *DTimestampTZ) IsMin() bool

IsMin implements the Datum interface.

func (*DTimestampTZ) Next Uses

func (d *DTimestampTZ) Next() Datum

Next implements the Datum interface.

func (*DTimestampTZ) Prev Uses

func (d *DTimestampTZ) Prev() Datum

Prev implements the Datum interface.

func (*DTimestampTZ) ReturnType Uses

func (*DTimestampTZ) ReturnType() Datum

ReturnType implements the TypedExpr interface.

func (*DTimestampTZ) String Uses

func (node *DTimestampTZ) String() string

func (*DTimestampTZ) Type Uses

func (d *DTimestampTZ) Type() string

Type implements the Datum interface.

func (*DTimestampTZ) TypeCheck Uses

func (d *DTimestampTZ) TypeCheck(_ *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DTimestampTZ) TypeEqual Uses

func (d *DTimestampTZ) TypeEqual(other Datum) bool

TypeEqual implements the Datum interface.

func (*DTimestampTZ) Walk Uses

func (expr *DTimestampTZ) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DTuple Uses

type DTuple []Datum

DTuple is the tuple Datum.

func (*DTuple) Compare Uses

func (d *DTuple) Compare(other Datum) int

Compare implements the Datum interface.

func (*DTuple) Eval Uses

func (t *DTuple) Eval(_ *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*DTuple) Format Uses

func (d *DTuple) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*DTuple) HasNext Uses

func (d *DTuple) HasNext() bool

HasNext implements the Datum interface.

func (*DTuple) HasPrev Uses

func (d *DTuple) HasPrev() bool

HasPrev implements the Datum interface.

func (*DTuple) IsMax Uses

func (*DTuple) IsMax() bool

IsMax implements the Datum interface.

func (*DTuple) IsMin Uses

func (*DTuple) IsMin() bool

IsMin implements the Datum interface.

func (*DTuple) Len Uses

func (d *DTuple) Len() int

func (*DTuple) Less Uses

func (d *DTuple) Less(i, j int) bool

func (*DTuple) Next Uses

func (d *DTuple) Next() Datum

Next implements the Datum interface.

func (*DTuple) Normalize Uses

func (d *DTuple) Normalize()

Normalize sorts and uniques the datum tuple.

func (*DTuple) Prev Uses

func (d *DTuple) Prev() Datum

Prev implements the Datum interface.

func (*DTuple) ReturnType Uses

func (d *DTuple) ReturnType() Datum

ReturnType implements the TypedExpr interface.

func (*DTuple) SortedDifference Uses

func (d *DTuple) SortedDifference(other *DTuple) *DTuple

SortedDifference finds the elements of d which are not in other, assuming that d and other are already sorted.

func (*DTuple) String Uses

func (node *DTuple) String() string

func (*DTuple) Swap Uses

func (d *DTuple) Swap(i, j int)

func (*DTuple) Type Uses

func (*DTuple) Type() string

Type implements the Datum interface.

func (*DTuple) TypeCheck Uses

func (d *DTuple) TypeCheck(_ *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.

func (*DTuple) TypeEqual Uses

func (d *DTuple) TypeEqual(other Datum) bool

TypeEqual implements the Datum interface.

func (*DTuple) Walk Uses

func (expr *DTuple) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type DateColType Uses

type DateColType struct {
}

DateColType represents a DATE type.

func (*DateColType) Format Uses

func (node *DateColType) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*DateColType) String Uses

func (node *DateColType) String() string

type Datum Uses

type Datum interface {
    TypedExpr
    // Type returns the (user-friendly) name of the type.
    Type() string
    // TypeEqual determines if the receiver and the other Datum have the same
    // type or not. This method should be used for asserting the type of all
    // Datum, with the exception of DNull, where it is safe/encouraged to perform
    // a direct equivalence check.
    TypeEqual(other Datum) bool
    // Compare returns -1 if the receiver is less than other, 0 if receiver is
    // equal to other and +1 if receiver is greater than other.
    // TODO(nvanbenschoten) Should we look into merging this with cmpOps?
    Compare(other Datum) int
    // HasPrev specifies if Prev() can be used to compute a previous value for
    // a datum. For example, DBytes doesn't support it (the previous for BB is BAZZZ..).
    HasPrev() bool
    // Prev returns the previous datum. If the receiver is "b" and the returned datum
    // is "a", then "a < b" and no other datum will compare such that "a < c <
    // b".
    // The return value is undefined if `IsMin()`.
    Prev() Datum
    // HasNext specifies if Next() can be used to compute a next value for a
    // datum. For example, DDecimal doesn't support it (the next for 1.0 is 1.00..1).
    HasNext() bool
    // Next returns the next datum. If the receiver is "a" and the returned datum
    // is "b", then "a < b" and no other datum will compare such that "a < c <
    // b".
    // The return value is undefined if `IsMax()`.
    Next() Datum
    // IsMax returns true if the datum is equal to the maximum value the datum
    // type can hold.
    IsMax() bool
    // IsMin returns true if the datum is equal to the minimum value the datum
    // type can hold.
    IsMin() bool
}

A Datum holds either a bool, int64, float64, string or []Datum.

var (
    // TypeBool is the type of a DBool.
    TypeBool Datum = DBoolFalse
    // TypeInt is the type of a DInt.
    TypeInt Datum = NewDInt(0)
    // TypeFloat is the type of a DFloat.
    TypeFloat Datum = NewDFloat(0)
    // TypeDecimal is the type of a DDecimal.
    TypeDecimal Datum = &DDecimal{}
    // TypeString is the type of a DString.
    TypeString Datum = NewDString("")
    // TypeBytes is the type of a DBytes.
    TypeBytes Datum = NewDBytes("")
    // TypeDate is the type of a DDate.
    TypeDate Datum = NewDDate(0)
    // TypeTimestamp is the type of a DTimestamp.
    TypeTimestamp Datum = &DTimestamp{}
    // TypeTimestampTZ is the type of a DTimestamp.
    TypeTimestampTZ Datum = &DTimestampTZ{}
    // TypeInterval is the type of a DInterval.
    TypeInterval Datum = &DInterval{}
    // TypeTuple is the type of a DTuple.
    TypeTuple Datum = &DTuple{}
)

type Deallocate Uses

type Deallocate struct {
    Name Name // empty for ALL
}

Deallocate represents a DEALLOCATE statement.

func (*Deallocate) Format Uses

func (node *Deallocate) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*Deallocate) StatementTag Uses

func (n *Deallocate) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Deallocate) StatementType Uses

func (*Deallocate) StatementType() StatementType

StatementType implements the Statement interface.

func (*Deallocate) String Uses

func (n *Deallocate) String() string

type DecimalColType Uses

type DecimalColType struct {
    Name  string
    Prec  int
    Scale int
}

DecimalColType represents a DECIMAL or NUMERIC type.

func (*DecimalColType) Format Uses

func (node *DecimalColType) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*DecimalColType) String Uses

func (node *DecimalColType) String() string

type DefaultVal Uses

type DefaultVal struct{}

DefaultVal represents the DEFAULT expression.

func (DefaultVal) Eval Uses

func (expr DefaultVal) Eval(_ *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (DefaultVal) Format Uses

func (node DefaultVal) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (DefaultVal) ReturnType Uses

func (DefaultVal) ReturnType() Datum

ReturnType implements the TypedExpr interface.

func (DefaultVal) String Uses

func (node DefaultVal) String() string

func (DefaultVal) TypeCheck Uses

func (expr DefaultVal) TypeCheck(_ *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (DefaultVal) Walk Uses

func (expr DefaultVal) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type Delete Uses

type Delete struct {
    Table     TableExpr
    Where     *Where
    Returning ReturningExprs
}

Delete represents a DELETE statement.

func (*Delete) CopyNode Uses

func (stmt *Delete) CopyNode() *Delete

CopyNode makes a copy of this Expr without recursing in any child Exprs.

func (*Delete) Format Uses

func (node *Delete) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*Delete) StatementTag Uses

func (*Delete) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Delete) StatementType Uses

func (n *Delete) StatementType() StatementType

StatementType implements the Statement interface.

func (*Delete) String Uses

func (n *Delete) String() string

func (*Delete) WalkStmt Uses

func (stmt *Delete) WalkStmt(v Visitor) Statement

WalkStmt is part of the WalkableStmt interface.

type Direction Uses

type Direction int

Direction for ordering results.

const (
    DefaultDirection Direction = iota
    Ascending
    Descending
)

Direction values.

func (Direction) String Uses

func (d Direction) String() string

type DropBehavior Uses

type DropBehavior int

DropBehavior represents options for dropping schema elements.

const (
    DropDefault DropBehavior = iota
    DropRestrict
    DropCascade
)

DropBehavior values.

func (DropBehavior) String Uses

func (d DropBehavior) String() string

type DropDatabase Uses

type DropDatabase struct {
    Name     Name
    IfExists bool
}

DropDatabase represents a DROP DATABASE statement.

func (*DropDatabase) Format Uses

func (node *DropDatabase) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*DropDatabase) StatementTag Uses

func (*DropDatabase) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*DropDatabase) StatementType Uses

func (*DropDatabase) StatementType() StatementType

StatementType implements the Statement interface.

func (*DropDatabase) String Uses

func (n *DropDatabase) String() string

type DropIndex Uses

type DropIndex struct {
    IndexList    TableNameWithIndexList
    IfExists     bool
    DropBehavior DropBehavior
}

DropIndex represents a DROP INDEX statement.

func (*DropIndex) Format Uses

func (node *DropIndex) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*DropIndex) StatementTag Uses

func (*DropIndex) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*DropIndex) StatementType Uses

func (*DropIndex) StatementType() StatementType

StatementType implements the Statement interface.

func (*DropIndex) String Uses

func (n *DropIndex) String() string

type DropTable Uses

type DropTable struct {
    Names        QualifiedNames
    IfExists     bool
    DropBehavior DropBehavior
}

DropTable represents a DROP TABLE statement.

func (*DropTable) Format Uses

func (node *DropTable) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*DropTable) StatementTag Uses

func (*DropTable) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*DropTable) StatementType Uses

func (*DropTable) StatementType() StatementType

StatementType implements the Statement interface.

func (*DropTable) String Uses

func (n *DropTable) String() string

type EvalContext Uses

type EvalContext struct {
    NodeID roachpb.NodeID

    // Location references the *Location on the current Session.
    Location **time.Location

    ReCache *RegexpCache

    // TODO(mjibson): remove prepareOnly in favor of a 2-step prepare-exec solution
    // that is also able to save the plan to skip work during the exec step.
    PrepareOnly bool

    // SkipNormalize indicates whether expressions should be normalized
    // (false) or not (true).  It is set to true conditionally by
    // EXPLAIN(TYPES[, NORMALIZE]).
    SkipNormalize bool
    // contains filtered or unexported fields
}

EvalContext defines the context in which to evaluate an expression, allowing the retrieval of state such as the node ID or statement start time.

func (*EvalContext) GetClusterTimestamp Uses

func (ctx *EvalContext) GetClusterTimestamp() *DDecimal

GetClusterTimestamp retrieves the current cluster timestamp as per the evaluation context. The timestamp is guaranteed to be nonzero.

func (*EvalContext) GetLocation Uses

func (ctx *EvalContext) GetLocation() *time.Location

GetLocation returns the session timezone.

func (*EvalContext) GetStmtTimestamp Uses

func (ctx *EvalContext) GetStmtTimestamp() *DTimestamp

GetStmtTimestamp retrieves the current statement timestamp as per the evaluation context. The timestamp is guaranteed to be nonzero.

func (*EvalContext) GetTxnTimestamp Uses

func (ctx *EvalContext) GetTxnTimestamp(precision time.Duration) *DTimestamp

GetTxnTimestamp retrieves the current transaction timestamp as per the evaluation context. The timestamp is guaranteed to be nonzero.

func (*EvalContext) NormalizeExpr Uses

func (ctx *EvalContext) NormalizeExpr(typedExpr TypedExpr) (TypedExpr, error)

NormalizeExpr normalizes a typed expression, simplifying where possible, but guaranteeing that the result of evaluating the expression is unchanged and that resulting expression tree is still well-typed. Example normalizations:

(a)                   -> a
a = 1 + 1             -> a = 2
a + 1 = 2             -> a = 1
a BETWEEN b AND c     -> (a >= b) AND (a <= c)
a NOT BETWEEN b AND c -> (a < b) OR (a > c)

func (*EvalContext) SetClusterTimestamp Uses

func (ctx *EvalContext) SetClusterTimestamp(ts hlc.Timestamp)

SetClusterTimestamp sets the corresponding timestamp in the EvalContext.

func (*EvalContext) SetStmtTimestamp Uses

func (ctx *EvalContext) SetStmtTimestamp(ts time.Time)

SetStmtTimestamp sets the corresponding timestamp in the EvalContext.

func (*EvalContext) SetTxnTimestamp Uses

func (ctx *EvalContext) SetTxnTimestamp(ts time.Time)

SetTxnTimestamp sets the corresponding timestamp in the EvalContext.

type Execute Uses

type Execute struct {
    Name   Name
    Params Exprs
}

Execute represents an EXECUTE statement.

func (*Execute) Format Uses

func (node *Execute) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*Execute) StatementTag Uses

func (*Execute) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Execute) StatementType Uses

func (*Execute) StatementType() StatementType

StatementType implements the Statement interface.

func (*Execute) String Uses

func (n *Execute) String() string

type ExistsExpr Uses

type ExistsExpr struct {
    Subquery Expr
    // contains filtered or unexported fields
}

ExistsExpr represents an EXISTS expression.

func (*ExistsExpr) Eval Uses

func (t *ExistsExpr) Eval(ctx *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*ExistsExpr) Format Uses

func (node *ExistsExpr) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (ExistsExpr) ReturnType Uses

func (ta ExistsExpr) ReturnType() Datum

func (*ExistsExpr) String Uses

func (node *ExistsExpr) String() string

func (*ExistsExpr) TypeCheck Uses

func (expr *ExistsExpr) TypeCheck(ctx *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*ExistsExpr) Walk Uses

func (expr *ExistsExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type Explain Uses

type Explain struct {
    Options   []string
    Statement Statement
}

Explain represents an EXPLAIN statement.

func (*Explain) CopyNode Uses

func (stmt *Explain) CopyNode() *Explain

CopyNode makes a copy of this Expr without recursing in any child Exprs.

func (*Explain) Format Uses

func (node *Explain) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*Explain) StatementTag Uses

func (*Explain) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Explain) StatementType Uses

func (*Explain) StatementType() StatementType

StatementType implements the Statement interface.

func (*Explain) String Uses

func (n *Explain) String() string

func (*Explain) WalkStmt Uses

func (stmt *Explain) WalkStmt(v Visitor) Statement

WalkStmt is part of the WalkableStmt interface.

type Expr Uses

type Expr interface {
    fmt.Stringer
    NodeFormatter
    // Walk recursively walks all children using WalkExpr. If any children are changed, it returns a
    // copy of this node updated to point to the new children. Otherwise the receiver is returned.
    // For childless (leaf) Exprs, its implementation is empty.
    Walk(Visitor) Expr
    // TypeCheck transforms the Expr into a well-typed TypedExpr, which further permits
    // evaluation and type introspection, or an error if the expression cannot be well-typed.
    // When type checking is complete, if no error was reported, the expression and all
    // sub-expressions will be guaranteed to be well-typed, meaning that the method effectively
    // maps the Expr tree into a TypedExpr tree.
    //
    // The ctx parameter defines the context in which to perform type checking.
    // The desired parameter hints the desired type that the method's caller wants from
    // the resulting TypedExpr.
    TypeCheck(ctx *SemaContext, desired Datum) (TypedExpr, error)
}

Expr represents an expression.

func ParseExprTraditional Uses

func ParseExprTraditional(sql string) (Expr, error)

ParseExprTraditional is a short-hand for parseExprs(Traditional, []string{sql})

func SimpleVisit Uses

func SimpleVisit(expr Expr, preFn SimpleVisitFn) (Expr, error)

SimpleVisit is a convenience wrapper for visitors that only have VisitPre code and don't return any results except an error. The given function is called in VisitPre for every node. The visitor stops as soon as an error is returned.

func StripParens Uses

func StripParens(expr Expr) Expr

StripParens strips any parentheses surrounding an expression and returns the inner expression. For instance:

 1   -> 1
(1)  -> 1

((1)) -> 1

func WalkExpr Uses

func WalkExpr(v Visitor, expr Expr) (newExpr Expr, changed bool)

WalkExpr traverses the nodes in an expression.

type Exprs Uses

type Exprs []Expr

Exprs represents a list of value expressions. It's not a valid expression because it's not parenthesized.

func ParseExprsTraditional Uses

func ParseExprsTraditional(sql []string) (Exprs, error)

ParseExprsTraditional is a short-hand for parseExprs(Traditional, sql)

func (Exprs) Format Uses

func (node Exprs) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (Exprs) String Uses

func (node Exprs) String() string

type FamilyElem Uses

type FamilyElem struct {
    Column Name
}

FamilyElem represents a column in a FAMILY constraint.

func (FamilyElem) Format Uses

func (node FamilyElem) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type FamilyElemList Uses

type FamilyElemList []FamilyElem

FamilyElemList is list of FamilyElem.

func (FamilyElemList) Format Uses

func (l FamilyElemList) Format(buf *bytes.Buffer, f FmtFlags)

Format pretty-prints the contained names separated by commas. Format implements the NodeFormatter interface.

type FamilyTableDef Uses

type FamilyTableDef struct {
    Name    Name
    Columns FamilyElemList
}

FamilyTableDef represents a family definition within a CREATE TABLE statement.

func (*FamilyTableDef) Format Uses

func (node *FamilyTableDef) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type FloatColType Uses

type FloatColType struct {
    Name string
    Prec int
}

FloatColType represents a REAL, DOUBLE or FLOAT type.

func (*FloatColType) Format Uses

func (node *FloatColType) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*FloatColType) String Uses

func (node *FloatColType) String() string

type FmtFlags Uses

type FmtFlags *fmtFlags

FmtFlags enables conditional formatting in the pretty-printer.

var FmtQualify FmtFlags = &fmtFlags{showTableAliases: true}

FmtQualify instructs the pretty-printer to qualify qnames with the table name.

var FmtShowTypes FmtFlags = &fmtFlags{showTypes: true}

FmtShowTypes instructs the pretty-printer to annotate expressions with their resolved types.

var FmtSimple FmtFlags = &fmtFlags{showTypes: false}

FmtSimple instructs the pretty-printer to produce a straightforward representation, ideally using SQL syntax that makes prettyprint+parse idempotent.

type FuncExpr Uses

type FuncExpr struct {
    Name  *QualifiedName
    Type  funcType
    Exprs Exprs
    // contains filtered or unexported fields
}

FuncExpr represents a function call.

func (*FuncExpr) CopyNode Uses

func (expr *FuncExpr) CopyNode() *FuncExpr

CopyNode makes a copy of this Expr without recursing in any child Exprs.

func (*FuncExpr) Eval Uses

func (expr *FuncExpr) Eval(ctx *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*FuncExpr) Format Uses

func (node *FuncExpr) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (FuncExpr) ReturnType Uses

func (ta FuncExpr) ReturnType() Datum

func (*FuncExpr) String Uses

func (node *FuncExpr) String() string

func (*FuncExpr) TypeCheck Uses

func (expr *FuncExpr) TypeCheck(ctx *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*FuncExpr) Walk Uses

func (expr *FuncExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type Grant Uses

type Grant struct {
    Privileges privilege.List
    Targets    TargetList
    Grantees   NameList
}

Grant represents a GRANT statement.

func (*Grant) Format Uses

func (node *Grant) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*Grant) StatementTag Uses

func (*Grant) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Grant) StatementType Uses

func (*Grant) StatementType() StatementType

StatementType implements the Statement interface.

func (*Grant) String Uses

func (n *Grant) String() string

type GroupBy Uses

type GroupBy []Expr

GroupBy represents a GROUP BY clause.

func (GroupBy) Format Uses

func (node GroupBy) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type IfExpr Uses

type IfExpr struct {
    Cond Expr
    True Expr
    Else Expr
    // contains filtered or unexported fields
}

IfExpr represents an IF expression.

func (*IfExpr) Eval Uses

func (expr *IfExpr) Eval(ctx *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*IfExpr) Format Uses

func (node *IfExpr) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (IfExpr) ReturnType Uses

func (ta IfExpr) ReturnType() Datum

func (*IfExpr) String Uses

func (node *IfExpr) String() string

func (*IfExpr) TypeCheck Uses

func (expr *IfExpr) TypeCheck(ctx *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*IfExpr) TypedCondExpr Uses

func (node *IfExpr) TypedCondExpr() TypedExpr

TypedCondExpr returns the IfExpr's Cond expression as a TypedExpr.

func (*IfExpr) TypedElseExpr Uses

func (node *IfExpr) TypedElseExpr() TypedExpr

TypedElseExpr returns the IfExpr's Else expression as a TypedExpr.

func (*IfExpr) TypedTrueExpr Uses

func (node *IfExpr) TypedTrueExpr() TypedExpr

TypedTrueExpr returns the IfExpr's True expression as a TypedExpr.

func (*IfExpr) Walk Uses

func (expr *IfExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type IndexElem Uses

type IndexElem struct {
    Column    Name
    Direction Direction
}

IndexElem represents a column with a direction in a CREATE INDEX statement.

func (IndexElem) Format Uses

func (node IndexElem) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type IndexElemList Uses

type IndexElemList []IndexElem

IndexElemList is list of IndexElem.

func NameListToIndexElems Uses

func NameListToIndexElems(lst NameList) IndexElemList

NameListToIndexElems converts a NameList to an IndexElemList with all members using the `DefaultDirection`.

func (IndexElemList) Format Uses

func (l IndexElemList) Format(buf *bytes.Buffer, f FmtFlags)

Format pretty-prints the contained names separated by commas. Format implements the NodeFormatter interface.

type IndexHints Uses

type IndexHints struct {
    Index       Name
    NoIndexJoin bool
}

IndexHints represents "@<index_name>" or "@{param[,param]}" where param is one of:

- FORCE_INDEX=<index_name>
- NO_INDEX_JOIN

It is used optionally after a table name in SELECT statements.

func (*IndexHints) Format Uses

func (n *IndexHints) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type IndexTableDef Uses

type IndexTableDef struct {
    Name       Name
    Columns    IndexElemList
    Storing    NameList
    Interleave *InterleaveDef
}

IndexTableDef represents an index definition within a CREATE TABLE statement.

func (*IndexTableDef) Format Uses

func (node *IndexTableDef) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type IndexedVar Uses

type IndexedVar struct {
    Idx int
    // contains filtered or unexported fields
}

IndexedVar is a VariableExpr that can be used as a leaf in expressions; it represents a dynamic value. It defers calls to TypeCheck, Eval, String to an IndexedVarContainer.

func (*IndexedVar) Eval Uses

func (v *IndexedVar) Eval(ctx *EvalContext) (Datum, error)

Eval is part of the TypedExpr interface.

func (*IndexedVar) Format Uses

func (v *IndexedVar) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*IndexedVar) ReturnType Uses

func (v *IndexedVar) ReturnType() Datum

ReturnType is part of the TypedExpr interface.

func (*IndexedVar) String Uses

func (node *IndexedVar) String() string

func (*IndexedVar) TypeCheck Uses

func (v *IndexedVar) TypeCheck(_ *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck is part of the Expr interface.

func (*IndexedVar) Variable Uses

func (*IndexedVar) Variable()

Variable is a dummy function part of the VariableExpr interface.

func (*IndexedVar) Walk Uses

func (v *IndexedVar) Walk(_ Visitor) Expr

Walk is part of the Expr interface.

type IndexedVarContainer Uses

type IndexedVarContainer interface {
    IndexedVarEval(idx int, ctx *EvalContext) (Datum, error)
    IndexedVarReturnType(idx int) Datum
    IndexedVarString(idx int) string
}

IndexedVarContainer provides the implementation of TypeCheck, Eval, and String for IndexedVars.

type IndexedVarHelper Uses

type IndexedVarHelper struct {
    // contains filtered or unexported fields
}

IndexedVarHelper is a structure that helps with initialization of IndexVars.

func MakeIndexedVarHelper Uses

func MakeIndexedVarHelper(container IndexedVarContainer, numVars int) IndexedVarHelper

MakeIndexedVarHelper initializes an IndexedVarHelper structure.

func (*IndexedVarHelper) IndexedVar Uses

func (h *IndexedVarHelper) IndexedVar(idx int) *IndexedVar

IndexedVar returns an IndexedVar for the given index. The index must be valid.

func (*IndexedVarHelper) IndexedVarUsed Uses

func (h *IndexedVarHelper) IndexedVarUsed(idx int) bool

IndexedVarUsed returns true if IndexedVar() was called for the given index. The index must be valid.

func (*IndexedVarHelper) NumVars Uses

func (h *IndexedVarHelper) NumVars() int

NumVars returns the number of variables the IndexedVarHelper was initialized for.

type Indirection Uses

type Indirection []IndirectionElem

Indirection represents an indirection expression composed of a series of indirection elements.

func (Indirection) Format Uses

func (i Indirection) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type IndirectionElem Uses

type IndirectionElem interface {
    NodeFormatter
    // contains filtered or unexported methods
}

IndirectionElem is a single element in an indirection expression.

type Insert Uses

type Insert struct {
    Table      TableExpr
    Columns    QualifiedNames
    Rows       *Select
    OnConflict *OnConflict
    Returning  ReturningExprs
}

Insert represents an INSERT statement.

func (*Insert) CopyNode Uses

func (stmt *Insert) CopyNode() *Insert

CopyNode makes a copy of this Expr without recursing in any child Exprs.

func (*Insert) DefaultValues Uses

func (node *Insert) DefaultValues() bool

DefaultValues returns true iff only default values are being inserted.

func (*Insert) Format Uses

func (node *Insert) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*Insert) StatementTag Uses

func (*Insert) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Insert) StatementType Uses

func (n *Insert) StatementType() StatementType

StatementType implements the Statement interface.

func (*Insert) String Uses

func (n *Insert) String() string

func (*Insert) WalkStmt Uses

func (stmt *Insert) WalkStmt(v Visitor) Statement

WalkStmt is part of the WalkableStmt interface.

type IntColType Uses

type IntColType struct {
    Name string
    N    int
}

IntColType represents an INT, INTEGER, SMALLINT or BIGINT type.

func (*IntColType) Format Uses

func (node *IntColType) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*IntColType) IsSerial Uses

func (node *IntColType) IsSerial() bool

IsSerial returns true when this column should be given a DEFAULT of a unique, incrementing function.

func (*IntColType) String Uses

func (node *IntColType) String() string

type InterleaveDef Uses

type InterleaveDef struct {
    Parent       *QualifiedName
    Fields       []string
    DropBehavior DropBehavior
}

InterleaveDef represents an interleave definition within a CREATE TABLE or CREATE INDEX statement.

func (*InterleaveDef) Format Uses

func (node *InterleaveDef) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type IntervalColType Uses

type IntervalColType struct {
}

IntervalColType represents an INTERVAL type

func (*IntervalColType) Format Uses

func (node *IntervalColType) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*IntervalColType) String Uses

func (node *IntervalColType) String() string

type IsAggregateVisitor Uses

type IsAggregateVisitor struct {
    Aggregated bool
}

IsAggregateVisitor checks if walked expressions contain aggregate functions.

func (*IsAggregateVisitor) Reset Uses

func (v *IsAggregateVisitor) Reset()

Reset clear the IsAggregateVisitor's internal state.

func (*IsAggregateVisitor) VisitPost Uses

func (*IsAggregateVisitor) VisitPost(expr Expr) Expr

VisitPost satisfies the Visitor interface.

func (*IsAggregateVisitor) VisitPre Uses

func (v *IsAggregateVisitor) VisitPre(expr Expr) (recurse bool, newExpr Expr)

VisitPre satisfies the Visitor interface.

type IsOfTypeExpr Uses

type IsOfTypeExpr struct {
    Not   bool
    Expr  Expr
    Types []ColumnType
    // contains filtered or unexported fields
}

IsOfTypeExpr represents an IS {,NOT} OF (type_list) expression.

func (*IsOfTypeExpr) Eval Uses

func (expr *IsOfTypeExpr) Eval(ctx *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*IsOfTypeExpr) Format Uses

func (node *IsOfTypeExpr) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (IsOfTypeExpr) ReturnType Uses

func (ta IsOfTypeExpr) ReturnType() Datum

func (*IsOfTypeExpr) String Uses

func (node *IsOfTypeExpr) String() string

func (*IsOfTypeExpr) TypeCheck Uses

func (expr *IsOfTypeExpr) TypeCheck(ctx *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*IsOfTypeExpr) Walk Uses

func (expr *IsOfTypeExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type IsolationLevel Uses

type IsolationLevel int

IsolationLevel holds the isolation level for a transaction.

const (
    UnspecifiedIsolation IsolationLevel = iota
    SnapshotIsolation
    SerializableIsolation
)

IsolationLevel values

func (IsolationLevel) String Uses

func (i IsolationLevel) String() string

type JoinCond Uses

type JoinCond interface {
    NodeFormatter
    // contains filtered or unexported methods
}

JoinCond represents a join condition.

type JoinTableExpr Uses

type JoinTableExpr struct {
    Join  string
    Left  TableExpr
    Right TableExpr
    Cond  JoinCond
}

JoinTableExpr represents a TableExpr that's a JOIN operation.

func (*JoinTableExpr) Format Uses

func (node *JoinTableExpr) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*JoinTableExpr) String Uses

func (node *JoinTableExpr) String() string

type Limit Uses

type Limit struct {
    Offset, Count Expr
}

Limit represents a LIMIT clause.

func (*Limit) Format Uses

func (node *Limit) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type MaxAggregate Uses

type MaxAggregate struct {
    // contains filtered or unexported fields
}

MaxAggregate keeps track of the largest value passed to Add.

func (*MaxAggregate) Add Uses

func (a *MaxAggregate) Add(datum Datum) error

Add sets the max to the larger of the current max or the passed datum.

func (*MaxAggregate) Result Uses

func (a *MaxAggregate) Result() (Datum, error)

Result returns the largest value passed to Add.

type MinAggregate Uses

type MinAggregate struct {
    // contains filtered or unexported fields
}

MinAggregate keeps track of the smallest value passed to Add.

func (*MinAggregate) Add Uses

func (a *MinAggregate) Add(datum Datum) error

Add sets the min to the smaller of the current min or the passed datum.

func (*MinAggregate) Result Uses

func (a *MinAggregate) Result() (Datum, error)

Result returns the smallest value passed to Add.

type Name Uses

type Name string

A Name is an SQL identifier.

func (Name) Format Uses

func (n Name) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (Name) String Uses

func (node Name) String() string

type NameIndirection Uses

type NameIndirection Name

NameIndirection represents ".<name>" in an indirection expression.

func (NameIndirection) Format Uses

func (n NameIndirection) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type NameList Uses

type NameList []string

A NameList is a list of identifier. TODO(tschottdorf): would be nicer to have []Name here but unless we want to introduce new types to the grammar, NameList([]string{...}) needs to work.

func (NameList) Format Uses

func (l NameList) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (NameList) String Uses

func (list NameList) String() string

type NamedColumnQualification Uses

type NamedColumnQualification struct {
    Name          Name
    Qualification ColumnQualification
}

NamedColumnQualification wraps a NamedColumnQualification with a name.

type NaturalJoinCond Uses

type NaturalJoinCond struct{}

NaturalJoinCond represents a NATURAL join condition

func (NaturalJoinCond) Format Uses

func (NaturalJoinCond) Format(buf *bytes.Buffer, _ FmtFlags)

Format implements the NodeFormatter interface.

type NodeFormatter Uses

type NodeFormatter interface {
    // Format performs pretty-printing towards a bytes buffer. The
    // flags argument influences the results.
    Format(buf *bytes.Buffer, flags FmtFlags)
}

NodeFormatter is implemented by nodes that can be pretty-printed.

type NotExpr Uses

type NotExpr struct {
    Expr Expr
    // contains filtered or unexported fields
}

NotExpr represents a NOT expression.

func NewTypedNotExpr Uses

func NewTypedNotExpr(expr TypedExpr) *NotExpr

NewTypedNotExpr returns a new NotExpr that is verified to be well-typed.

func (*NotExpr) Eval Uses

func (expr *NotExpr) Eval(ctx *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*NotExpr) Format Uses

func (node *NotExpr) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (NotExpr) ReturnType Uses

func (ta NotExpr) ReturnType() Datum

func (*NotExpr) String Uses

func (node *NotExpr) String() string

func (*NotExpr) TypeCheck Uses

func (expr *NotExpr) TypeCheck(ctx *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*NotExpr) TypedInnerExpr Uses

func (node *NotExpr) TypedInnerExpr() TypedExpr

TypedInnerExpr returns the NotExpr's inner expression as a TypedExpr.

func (*NotExpr) Walk Uses

func (expr *NotExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type NotNullConstraint Uses

type NotNullConstraint struct{}

NotNullConstraint represents NOT NULL on a column.

type NullConstraint Uses

type NullConstraint struct{}

NullConstraint represents NULL on a column.

type NullIfExpr Uses

type NullIfExpr struct {
    Expr1 Expr
    Expr2 Expr
    // contains filtered or unexported fields
}

NullIfExpr represents a NULLIF expression.

func (*NullIfExpr) Eval Uses

func (expr *NullIfExpr) Eval(ctx *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*NullIfExpr) Format Uses

func (node *NullIfExpr) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (NullIfExpr) ReturnType Uses

func (ta NullIfExpr) ReturnType() Datum

func (*NullIfExpr) String Uses

func (node *NullIfExpr) String() string

func (*NullIfExpr) TypeCheck Uses

func (expr *NullIfExpr) TypeCheck(ctx *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*NullIfExpr) Walk Uses

func (expr *NullIfExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type Nullability Uses

type Nullability int

Nullability represents either NULL, NOT NULL or an unspecified value (silent NULL).

const (
    NotNull Nullability = iota
    Null
    SilentNull
)

The values for NullType.

type NumVal Uses

type NumVal struct {
    constant.Value

    // We preserve the "original" string representation (before folding).
    OrigString string
    // contains filtered or unexported fields
}

NumVal represents a constant numeric value.

func (*NumVal) AvailableTypes Uses

func (expr *NumVal) AvailableTypes() []Datum

AvailableTypes implements the Constant interface.

func (*NumVal) Format Uses

func (expr *NumVal) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*NumVal) ResolveAsType Uses

func (expr *NumVal) ResolveAsType(ctx *SemaContext, typ Datum) (Datum, error)

ResolveAsType implements the Constant interface.

func (*NumVal) String Uses

func (node *NumVal) String() string

func (*NumVal) TypeCheck Uses

func (expr *NumVal) TypeCheck(ctx *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*NumVal) Walk Uses

func (expr *NumVal) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type OnConflict Uses

type OnConflict struct {
    Columns   NameList
    Exprs     UpdateExprs
    Where     *Where
    DoNothing bool
}

OnConflict represents an `ON CONFLICT (columns) DO UPDATE SET exprs WHERE where` clause.

The zero value for OnConflict is used to signal the UPSERT short form, which uses the primary key for as the conflict index and the values being inserted for Exprs.

func (*OnConflict) IsUpsertAlias Uses

func (oc *OnConflict) IsUpsertAlias() bool

IsUpsertAlias returns true if the UPSERT syntactic sugar was used.

type OnJoinCond Uses

type OnJoinCond struct {
    Expr Expr
}

OnJoinCond represents an ON join condition.

func (*OnJoinCond) Format Uses

func (node *OnJoinCond) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type OrExpr Uses

type OrExpr struct {
    Left, Right Expr
    // contains filtered or unexported fields
}

OrExpr represents an OR expression.

func NewTypedOrExpr Uses

func NewTypedOrExpr(left, right TypedExpr) *OrExpr

NewTypedOrExpr returns a new OrExpr that is verified to be well-typed.

func (*OrExpr) Eval Uses

func (expr *OrExpr) Eval(ctx *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*OrExpr) Format Uses

func (node *OrExpr) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (OrExpr) ReturnType Uses

func (ta OrExpr) ReturnType() Datum

func (*OrExpr) String Uses

func (node *OrExpr) String() string

func (*OrExpr) TypeCheck Uses

func (expr *OrExpr) TypeCheck(ctx *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*OrExpr) TypedLeft Uses

func (node *OrExpr) TypedLeft() TypedExpr

TypedLeft returns the OrExpr's left expression as a TypedExpr.

func (*OrExpr) TypedRight Uses

func (node *OrExpr) TypedRight() TypedExpr

TypedRight returns the OrExpr's right expression as a TypedExpr.

func (*OrExpr) Walk Uses

func (expr *OrExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type Order Uses

type Order struct {
    Expr      Expr
    Direction Direction
}

Order represents an ordering expression.

func (*Order) Format Uses

func (node *Order) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type OrderBy Uses

type OrderBy []*Order

OrderBy represents an ORDER By clause.

func (OrderBy) Format Uses

func (node OrderBy) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type OverlayExpr Uses

type OverlayExpr struct {
    FuncExpr
}

OverlayExpr represents an overlay function call.

func (*OverlayExpr) Eval Uses

func (expr *OverlayExpr) Eval(ctx *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*OverlayExpr) Format Uses

func (node *OverlayExpr) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (OverlayExpr) ReturnType Uses

func (ta OverlayExpr) ReturnType() Datum

func (*OverlayExpr) String Uses

func (node *OverlayExpr) String() string

type ParenExpr Uses

type ParenExpr struct {
    Expr Expr
    // contains filtered or unexported fields
}

ParenExpr represents a parenthesized expression.

func (*ParenExpr) Eval Uses

func (expr *ParenExpr) Eval(ctx *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*ParenExpr) Format Uses

func (node *ParenExpr) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (ParenExpr) ReturnType Uses

func (ta ParenExpr) ReturnType() Datum

func (*ParenExpr) String Uses

func (node *ParenExpr) String() string

func (*ParenExpr) TypeCheck Uses

func (expr *ParenExpr) TypeCheck(ctx *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*ParenExpr) TypedInnerExpr Uses

func (node *ParenExpr) TypedInnerExpr() TypedExpr

TypedInnerExpr returns the ParenExpr's inner expression as a TypedExpr.

func (*ParenExpr) Walk Uses

func (expr *ParenExpr) Walk(v Visitor) Expr

Walk implements the Expr interface.

type ParenSelect Uses

type ParenSelect struct {
    Select *Select
}

ParenSelect represents a parenthesized SELECT/UNION/VALUES statement.

func (*ParenSelect) Format Uses

func (node *ParenSelect) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*ParenSelect) StatementTag Uses

func (*ParenSelect) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ParenSelect) StatementType Uses

func (*ParenSelect) StatementType() StatementType

StatementType implements the Statement interface.

func (*ParenSelect) String Uses

func (n *ParenSelect) String() string

func (*ParenSelect) WalkStmt Uses

func (stmt *ParenSelect) WalkStmt(v Visitor) Statement

WalkStmt is part of the WalkableStmt interface.

type ParenTableExpr Uses

type ParenTableExpr struct {
    Expr TableExpr
}

ParenTableExpr represents a parenthesized TableExpr.

func (*ParenTableExpr) Format Uses

func (node *ParenTableExpr) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*ParenTableExpr) String Uses

func (node *ParenTableExpr) String() string

type Parser Uses

type Parser struct {
    // contains filtered or unexported fields
}

Parser wraps a scanner, parser and other utilities present in the parser package.

func (*Parser) AggregateInExpr Uses

func (p *Parser) AggregateInExpr(expr Expr) bool

AggregateInExpr determines if an Expr contains an aggregate function.

func (*Parser) IsAggregate Uses

func (p *Parser) IsAggregate(n *SelectClause) bool

IsAggregate determines if SelectClause contains an aggregate function.

func (*Parser) NormalizeExpr Uses

func (p *Parser) NormalizeExpr(ctx *EvalContext, typedExpr TypedExpr) (TypedExpr, error)

NormalizeExpr is wrapper around ctx.NormalizeExpr which avoids allocation of a normalizeVisitor.

func (*Parser) Parse Uses

func (p *Parser) Parse(sql string, syntax Syntax) (stmts StatementList, err error)

Parse parses the sql and returns a list of statements.

type Placeholder Uses

type Placeholder struct {
    Name string
}

Placeholder represents a named placeholder.

func (Placeholder) Format Uses

func (node Placeholder) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (Placeholder) String Uses

func (node Placeholder) String() string

func (Placeholder) TypeCheck Uses

func (expr Placeholder) TypeCheck(ctx *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (Placeholder) Variable Uses

func (Placeholder) Variable()

Variable implements the VariableExpr interface.

func (Placeholder) Walk Uses

func (expr Placeholder) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type PlaceholderInfo Uses

type PlaceholderInfo struct {
    Values QueryArguments
    Types  PlaceholderTypes
}

PlaceholderInfo defines the interface to SQL placeholders.

func NewPlaceholderInfo Uses

func NewPlaceholderInfo() *PlaceholderInfo

NewPlaceholderInfo constructs an empty PlaceholderInfo.

func (*PlaceholderInfo) Assign Uses

func (p *PlaceholderInfo) Assign(src *PlaceholderInfo)

Assign resets the PlaceholderInfo to the contents of src. If src is nil, the map is cleared.

func (*PlaceholderInfo) Clear Uses

func (p *PlaceholderInfo) Clear()

Clear resets the placeholder info map.

func (*PlaceholderInfo) IsUnresolvedPlaceholder Uses

func (p *PlaceholderInfo) IsUnresolvedPlaceholder(expr Expr) bool

IsUnresolvedPlaceholder returns whether expr is an unresolved placeholder. In other words, it returns whether the provided expression is a placeholder expression or a placeholder expression within nested parentheses, and if so, whether the placeholder's type remains unset in the PlaceholderInfo.

func (*PlaceholderInfo) SetType Uses

func (p *PlaceholderInfo) SetType(name string, typ Datum) error

SetType assignes a known type to a placeholder. Reports an error if another type was previously assigned.

func (*PlaceholderInfo) SetTypes Uses

func (p *PlaceholderInfo) SetTypes(src PlaceholderTypes)

SetTypes resets the type and values in the map and replaces the types map by an alias to src. If src is nil, the map is cleared. The types map is aliased because the invoking code from pgwire/v3.go for sql.Prepare needs to receive the updated type assignments after Prepare completes.

func (*PlaceholderInfo) SetValue Uses

func (p *PlaceholderInfo) SetValue(name string, val Datum)

SetValue assigns a known value to a placeholder. If no type is known yet, it is inferred from the assigned value.

func (*PlaceholderInfo) Type Uses

func (p *PlaceholderInfo) Type(name string) (Datum, bool)

Type returns the known type of a placeholder. Returns false in the 2nd value if the placeholder is not typed.

func (*PlaceholderInfo) Value Uses

func (p *PlaceholderInfo) Value(name string) (Datum, bool)

Value returns the known value of a placeholder. Returns false in the 2nd value if the placeholder does not have a value.

type PlaceholderTypes Uses

type PlaceholderTypes map[string]Datum

PlaceholderTypes relates placeholder names to their resolved type.

func (PlaceholderTypes) ProcessPlaceholderAnnotations Uses

func (p PlaceholderTypes) ProcessPlaceholderAnnotations(stmt Statement) error

ProcessPlaceholderAnnotations performs an order-independent global traversal of the provided Statement, annotating all placeholders with a type in either of the following situations. - the placeholder is the subject of an explicit type annotation in at least one

of its occurrences. If it is subject to multiple explicit type annotations where
the types are not all in agreement, or if the placeholder already has an inferred
type in the placeholder map which conflicts with the explicit type annotation
type, an error will be thrown.

- the placeholder is the subject to an implicit type annotation, meaning that it

is not subject to an explicit type annotation, and that in all occurrences of the
placeholder, it is subject to a cast to the same type. If it is subject to casts
of multiple types, no error will be thrown, but the placeholder type will not be
inferred. If a type has already been assigned for the placeholder in the placeholder
map, no error will be thrown, and the placeholder will keep it's previously
inferred type.

TODO(nvanbenschoten) Can this visitor and map be preallocated (like normalizeVisitor)?

type Prepare Uses

type Prepare struct {
    Name      Name
    Types     []ColumnType
    Statement Statement
}

Prepare represents a PREPARE statement.

func (*Prepare) Format Uses

func (node *Prepare) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*Prepare) StatementTag Uses

func (*Prepare) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Prepare) StatementType Uses

func (*Prepare) StatementType() StatementType

StatementType implements the Statement interface.

func (*Prepare) String Uses

func (n *Prepare) String() string

type PrimaryKeyConstraint Uses

type PrimaryKeyConstraint struct{}

PrimaryKeyConstraint represents NULL on a column.

type QualifiedName Uses

type QualifiedName struct {
    Base     Name
    Indirect Indirection
    // contains filtered or unexported fields
}

QualifiedName is a base name and an optional indirection expression.

func StarExpr Uses

func StarExpr() *QualifiedName

StarExpr is a convenience function that represents an unqualified "*".

func (*QualifiedName) ClearString Uses

func (node *QualifiedName) ClearString()

ClearString causes String to return the current (possibly normalized) name instead of the original name (used for testing).

func (*QualifiedName) Column Uses

func (node *QualifiedName) Column() string

Column returns the column portion of the name. Note that the returned string is not quoted even if the name is a keyword.

func (*QualifiedName) Database Uses

func (node *QualifiedName) Database() string

Database returns the database portion of the name. Note that the returned string is not quoted even if the name is a keyword.

func (*QualifiedName) Eval Uses

func (expr *QualifiedName) Eval(ctx *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*QualifiedName) Format Uses

func (node *QualifiedName) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*QualifiedName) IsStar Uses

func (node *QualifiedName) IsStar() bool

IsStar returns true iff the qualified name contains matches "".* or table.*.

func (*QualifiedName) NormalizeColumnName Uses

func (node *QualifiedName) NormalizeColumnName() error

NormalizeColumnName normalizes the qualified name to contain a table name as prefix, returning an error if unable to do so or if the name is not a valid column name (e.g. it contains too many indirections). If normalization occurred, the modified qualified name will have n.Base == "" to indicate no explicit table was specified. The incoming qualified name should have one of the following forms:

*
table.*
column
column[array-indirection]
table.column
table.column[array-indirection]

Note that "table" may be the empty string. On successful normalization the qualified name will have one of the forms:

table.*
table.column
table.column[array-indirection]

func (*QualifiedName) NormalizeTableName Uses

func (node *QualifiedName) NormalizeTableName(database string) error

NormalizeTableName normalizes the qualified name to contain a database name as prefix, returning an error if unable to do so or if the name is not a valid table name (e.g. it contains an array indirection). The incoming qualified name should have one of the following forms:

table
database.table
table@index
database.table@index

On successful normalization, the qualified name will have the form:

database.table@index

func (*QualifiedName) QualifyWithDatabase Uses

func (node *QualifiedName) QualifyWithDatabase(database string) error

QualifyWithDatabase adds an indirection for the database, if it's missing. It transforms: table -> database.table table@index -> database.table@index * -> database.*

func (*QualifiedName) ReturnType Uses

func (node *QualifiedName) ReturnType() Datum

ReturnType implements the TypedExpr interface.

func (*QualifiedName) String Uses

func (node *QualifiedName) String() string

func (*QualifiedName) Table Uses

func (node *QualifiedName) Table() string

Table returns the table portion of the name. Note that the returned string is not quoted even if the name is a keyword.

func (*QualifiedName) TypeCheck Uses

func (expr *QualifiedName) TypeCheck(_ *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*QualifiedName) Variable Uses

func (*QualifiedName) Variable()

Variable implements the VariableExpr interface.

func (*QualifiedName) Walk Uses

func (expr *QualifiedName) Walk(_ Visitor) Expr

Walk implements the Expr interface.

type QualifiedNames Uses

type QualifiedNames []*QualifiedName

QualifiedNames represents a command separated list (see the String method) of qualified names.

func (QualifiedNames) Format Uses

func (n QualifiedNames) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type QueryArguments Uses

type QueryArguments map[string]Datum

QueryArguments relates placeholder names to their provided query argument.

type RangeCond Uses

type RangeCond struct {
    Not      bool
    Left     Expr
    From, To Expr
    // contains filtered or unexported fields
}

RangeCond represents a BETWEEN or a NOT BETWEEN expression.

func (*RangeCond) Eval Uses

func (expr *RangeCond) Eval(_ *EvalContext) (Datum, error)

Eval implements the TypedExpr interface.

func (*RangeCond) Format Uses

func (node *RangeCond) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (RangeCond) ReturnType Uses

func (ta RangeCond) ReturnType() Datum

func (*RangeCond) String Uses

func (node *RangeCond) String() string

func (*RangeCond) TypeCheck Uses

func (expr *RangeCond) TypeCheck(ctx *SemaContext, desired Datum) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*RangeCond) TypedFrom Uses

func (node *RangeCond) TypedFrom() TypedExpr

TypedFrom returns the RangeCond's from expression as a TypedExpr.

func (*RangeCond) TypedLeft Uses

func (node *RangeCond) TypedLeft() TypedExpr

TypedLeft returns the RangeCond's left expression as a TypedExpr.

func (*RangeCond) TypedTo Uses

func (node *RangeCond) TypedTo() TypedExpr

TypedTo returns the RangeCond's to expression as a TypedExpr.

func (*RangeCond) Walk Uses

func (expr *RangeCond) Walk(v Visitor) Expr

Walk implements the Expr interface.

type RegexpCache Uses

type RegexpCache struct {
    // contains filtered or unexported fields
}

A RegexpCache is a cache used to store compiled regular expressions. The cache is safe for concurrent use by multiple goroutines. It is also safe to use the cache through a nil reference, where it will act like a valid cache with no capacity.

func NewRegexpCache Uses

func NewRegexpCache(size int) *RegexpCache

NewRegexpCache creates a new RegexpCache of the given size. The underlying cache internally uses a hash map, so lookups are cheap.

func (*RegexpCache) GetRegexp Uses

func (rc *RegexpCache) GetRegexp(key regexpCacheKey) (*regexp.Regexp, error)

GetRegexp consults the cache for the regular expressions stored for the given key, compiling the key's pattern if it is not already in the cache.

func (*RegexpCache) Len Uses

func (rc *RegexpCache) Len() int

Len returns the number of compiled regular expressions in the cache.

type ReleaseSavepoint Uses

type ReleaseSavepoint struct {
    Savepoint string
}

ReleaseSavepoint represents a RELEASE SAVEPOINT <name> statement.

func (*ReleaseSavepoint) Format Uses

func (node *ReleaseSavepoint) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*ReleaseSavepoint) StatementTag Uses

func (*ReleaseSavepoint) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ReleaseSavepoint) StatementType Uses

func (*ReleaseSavepoint) StatementType() StatementType

StatementType implements the Statement interface.

func (*ReleaseSavepoint) String Uses

func (n *ReleaseSavepoint) String() string

type RenameColumn Uses

type RenameColumn struct {
    Table   *QualifiedName
    Name    Name
    NewName Name
    // IfExists refers to the table, not the column.
    IfExists bool
}

RenameColumn represents a RENAME COLUMN statement.

func (*RenameColumn) Format Uses

func (node *RenameColumn) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*RenameColumn) StatementTag Uses

func (*RenameColumn) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*RenameColumn) StatementType Uses

func (*RenameColumn) StatementType() StatementType

StatementType implements the Statement interface.

func (*RenameColumn) String Uses

func (n *RenameColumn) String() string

type RenameDatabase Uses

type RenameDatabase struct {
    Name    Name
    NewName Name
}

RenameDatabase represents a RENAME DATABASE statement.

func (*RenameDatabase) Format Uses

func (node *RenameDatabase) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*RenameDatabase) StatementTag Uses

func (*RenameDatabase) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*RenameDatabase) StatementType Uses

func (*RenameDatabase) StatementType() StatementType

StatementType implements the Statement interface.

func (*RenameDatabase) String Uses

func (n *RenameDatabase) String() string

type RenameIndex Uses

type RenameIndex struct {
    Index    *TableNameWithIndex
    NewName  Name
    IfExists bool
}

RenameIndex represents a RENAME INDEX statement.

func (*RenameIndex) Format Uses

func (node *RenameIndex) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*RenameIndex) StatementTag Uses

func (*RenameIndex) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*RenameIndex) StatementType Uses

func (*RenameIndex) StatementType() StatementType

StatementType implements the Statement interface.

func (*RenameIndex) String Uses

func (n *RenameIndex) String() string

type RenameTable Uses

type RenameTable struct {
    Name     *QualifiedName
    NewName  *QualifiedName
    IfExists bool
}

RenameTable represents a RENAME TABLE statement.

func (*RenameTable) Format Uses

func (node *RenameTable) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*RenameTable) StatementTag Uses

func (*RenameTable) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*RenameTable) StatementType Uses

func (*RenameTable) StatementType() StatementType

StatementType implements the Statement interface.

func (*RenameTable) String Uses

func (n *RenameTable) String() string

type ReturningExprs Uses

type ReturningExprs SelectExprs

ReturningExprs represents RETURNING expressions.

func (ReturningExprs) Format Uses

func (r ReturningExprs) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (ReturningExprs) StatementType Uses

func (r ReturningExprs) StatementType() StatementType

StatementType implements the Statement interface.

type Revoke Uses

type Revoke struct {
    Privileges privilege.List
    Targets    TargetList
    Grantees   NameList
}

Revoke represents a REVOKE statements. PrivilegeList and TargetList are defined in grant.go

func (*Revoke) Format Uses

func (node *Revoke) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*Revoke) StatementTag Uses

func (*Revoke) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Revoke) StatementType Uses

func (*Revoke) StatementType() StatementType

StatementType implements the Statement interface.

func (*Revoke) String Uses

func (n *Revoke) String() string

type RollbackToSavepoint Uses

type RollbackToSavepoint struct {
    Savepoint string
}

RollbackToSavepoint represents a ROLLBACK TO SAVEPOINT <name> statement.

func (*RollbackToSavepoint) Format Uses

func (node *RollbackToSavepoint) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*RollbackToSavepoint) StatementTag Uses

func (*RollbackToSavepoint) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*RollbackToSavepoint) StatementType Uses

func (*RollbackToSavepoint) StatementType() StatementType

StatementType implements the Statement interface.

func (*RollbackToSavepoint) String Uses

func (n *RollbackToSavepoint) String() string

type RollbackTransaction Uses

type RollbackTransaction struct{}

RollbackTransaction represents a ROLLBACK statement.

func (*RollbackTransaction) Format Uses

func (node *RollbackTransaction) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*RollbackTransaction) StatementTag Uses

func (*RollbackTransaction) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*RollbackTransaction) StatementType Uses

func (*RollbackTransaction) StatementType() StatementType

StatementType implements the Statement interface.

func (*RollbackTransaction) String Uses

func (n *RollbackTransaction) String() string

type Savepoint Uses

type Savepoint struct {
    Name string
}

Savepoint represents a SAVEPOINT <name> statement.

func (*Savepoint) Format Uses

func (node *Savepoint) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*Savepoint) StatementTag Uses

func (*Savepoint) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Savepoint) StatementType Uses

func (*Savepoint) StatementType() StatementType

StatementType implements the Statement interface.

func (*Savepoint) String Uses

func (n *Savepoint) String() string

type Scanner Uses

type Scanner struct {
    // contains filtered or unexported fields
}

Scanner lexes SQL statements.

func MakeScanner Uses

func MakeScanner(str string, syntax Syntax) Scanner

MakeScanner makes a Scanner from str.

func (*Scanner) Error Uses

func (s *Scanner) Error(e string)

func (*Scanner) Lex Uses

func (s *Scanner) Lex(lval *sqlSymType) int

Lex lexes a token from input.

func (*Scanner) Tokens Uses

func (s *Scanner) Tokens(f func(token int))

Tokens calls f on all tokens of the input until an EOF is encountered.

type Select Uses

type Select struct {
    Select  SelectStatement
    OrderBy OrderBy
    Limit   *Limit
}

Select represents a SelectStatement with an ORDER and/or LIMIT.

func (*Select) CopyNode Uses

func (stmt *Select) CopyNode() *Select

CopyNode makes a copy of this Expr without recursing in any child Exprs.

func (*Select) Format Uses

func (node *Select) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*Select) StatementTag Uses

func (*Select) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Select) StatementType Uses

func (*Select) StatementType() StatementType

StatementType implements the Statement interface.

func (*Select) String Uses

func (n *Select) String() string

func (*Select) WalkStmt Uses

func (stmt *Select) WalkStmt(v Visitor) Statement

WalkStmt is part of the WalkableStmt interface.

type SelectClause Uses

type SelectClause struct {
    Distinct bool
    Exprs    SelectExprs
    From     TableExprs
    Where    *Where
    GroupBy  GroupBy
    Having   *Where
    Lock     string
    // contains filtered or unexported fields
}

SelectClause represents a SELECT statement.

func (*SelectClause) CopyNode Uses

func (stmt *SelectClause) CopyNode() *SelectClause

CopyNode makes a copy of this Expr without recursing in any child Exprs.

func (*SelectClause) Format Uses

func (node *SelectClause) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*SelectClause) StatementTag Uses

func (*SelectClause) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*SelectClause) StatementType Uses

func (*SelectClause) StatementType() StatementType

StatementType implements the Statement interface.

func (*SelectClause) String Uses

func (n *SelectClause) String() string

func (*SelectClause) WalkStmt Uses

func (stmt *SelectClause) WalkStmt(v Visitor) Statement

WalkStmt is part of the WalkableStmt interface.

type SelectExpr Uses

type SelectExpr struct {
    Expr Expr
    As   Name
}

SelectExpr represents a SELECT expression.

func (SelectExpr) Format Uses

func (node SelectExpr) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type SelectExprs Uses

type SelectExprs []SelectExpr

SelectExprs represents SELECT expressions.

func (SelectExprs) Format Uses

func (node SelectExprs) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

type SelectStatement Uses

type SelectStatement interface {
    Statement
    // contains filtered or unexported methods
}

SelectStatement any SELECT statement.

type SemaContext Uses

type SemaContext struct {
    // Placeholders relates placeholder names to their type and, later, value.
    Placeholders *PlaceholderInfo

    // Location references the *Location on the current Session.
    Location **time.Location
}

SemaContext defines the context in which to perform semantic analysis on an expression syntax tree.

func MakeSemaContext Uses

func MakeSemaContext() SemaContext

MakeSemaContext initializes a simple SemaContext suitable for "lightweight" type checking such as the one performed for default expressions.

type Set Uses

type Set struct {
    Name   *QualifiedName
    Values Exprs
}

Set represents a SET statement.

func (*Set) CopyNode Uses

func (stmt *Set) CopyNode() *Set

CopyNode makes a copy of this Expr without recursing in any child Exprs.

func (*Set) Format Uses

func (node *Set) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*Set) StatementTag Uses

func (*Set) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Set) StatementType Uses

func (*Set) StatementType() StatementType

StatementType implements the Statement interface.

func (*Set) String Uses

func (n *Set) String() string

func (*Set) WalkStmt Uses

func (stmt *Set) WalkStmt(v Visitor) Statement

WalkStmt is part of the WalkableStmt interface.

type SetDefaultIsolation Uses

type SetDefaultIsolation struct {
    Isolation IsolationLevel
}

SetDefaultIsolation represents a SET SESSION CHARACTERISTICS AS TRANSACTION statement.

func (*SetDefaultIsolation) Format Uses

func (node *SetDefaultIsolation) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*SetDefaultIsolation) StatementTag Uses

func (*SetDefaultIsolation) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*SetDefaultIsolation) StatementType Uses

func (*SetDefaultIsolation) StatementType() StatementType

StatementType implements the Statement interface.

func (*SetDefaultIsolation) String Uses

func (n *SetDefaultIsolation) String() string

type SetTimeZone Uses

type SetTimeZone struct {
    Value Expr
}

SetTimeZone represents a SET TIME ZONE statement.

func (*SetTimeZone) Format Uses

func (node *SetTimeZone) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*SetTimeZone) StatementTag Uses

func (*SetTimeZone) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*SetTimeZone) StatementType Uses

func (*SetTimeZone) StatementType() StatementType

StatementType implements the Statement interface.

func (*SetTimeZone) String Uses

func (n *SetTimeZone) String() string

type SetTransaction Uses

type SetTransaction struct {
    Isolation    IsolationLevel
    UserPriority UserPriority
}

SetTransaction represents a SET TRANSACTION statement.

func (*SetTransaction) Format Uses

func (node *SetTransaction) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*SetTransaction) StatementTag Uses

func (*SetTransaction) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*SetTransaction) StatementType Uses

func (*SetTransaction) StatementType() StatementType

StatementType implements the Statement interface.

func (*SetTransaction) String Uses

func (n *SetTransaction) String() string

type Show Uses

type Show struct {
    Name string
}

Show represents a SHOW statement.

func (*Show) Format Uses

func (node *Show) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*Show) StatementTag Uses

func (*Show) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Show) StatementType Uses

func (*Show) StatementType() StatementType

StatementType implements the Statement interface.

func (*Show) String Uses

func (n *Show) String() string

type ShowColumns Uses

type ShowColumns struct {
    Table *QualifiedName
}

ShowColumns represents a SHOW COLUMNS statement.

func (*ShowColumns) Format Uses

func (node *ShowColumns) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*ShowColumns) StatementTag Uses

func (*ShowColumns) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowColumns) StatementType Uses

func (*ShowColumns) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowColumns) String Uses

func (n *ShowColumns) String() string

type ShowConstraints Uses

type ShowConstraints struct {
    Table *QualifiedName
}

ShowConstraints represents a SHOW CONSTRAINTS statement.

func (*ShowConstraints) Format Uses

func (node *ShowConstraints) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*ShowConstraints) StatementTag Uses

func (*ShowConstraints) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*ShowConstraints) StatementType Uses

func (*ShowConstraints) StatementType() StatementType

StatementType implements the Statement interface.

func (*ShowConstraints) String Uses

func (n *ShowConstraints) String() string

type ShowCreateTable Uses

type ShowCreateTable struct {
    Table *QualifiedName
}

ShowCreateTable represents a SHOW CREATE TABLE statement.

func (*ShowCreateTable) Format Uses

func (node *ShowCreateTable) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*ShowCreateTable) StatementTag Uses