cockroach: github.com/cockroachdb/cockroach/pkg/sql/parser Index | Files

package parser

import "github.com/cockroachdb/cockroach/pkg/sql/parser"

Code generated by goyacc. DO NOT EDIT. GENERATED FILE DO NOT EDIT

Index

Package Files

aggregate_builtins.go alter_table.go backup.go builtins.go col_types.go constant.go copy.go create.go datum.go decimal.go delete.go discard.go drop.go encode.go eval.go explain.go expr.go format.go function_definition.go function_name.go generator_builtins.go grant.go help.go help_messages.go hide_constants.go import.go indexed_vars.go insert.go interval.go keywords.go name_part.go normalize.go overload.go parse.go pg_builtins.go placeholders.go prepare.go regexp_cache.go rename.go reserved_keywords.go returning.go revoke.go run_control.go scan.go search_path.go select.go set.go show.go split.go sql.go stmt.go table_name.go table_pattern.go table_ref.go truncate.go txn.go type.go type_check.go union.go update.go values.go var_name.go walk.go window_builtins.go

Constants

const (
    DistinctFuncType funcType
    AllFuncType
)

FuncExpr.Type

const ACTION = 57362
const ADD = 57363
const ALL = 57364
const ALTER = 57365
const ANALYSE = 57366
const ANALYZE = 57367
const AND = 57368
const ANNOTATE_TYPE = 57370
const ANY = 57369
const ARRAY = 57371
const AS = 57372
const ASC = 57373
const ASYMMETRIC = 57374
const AS_LA = 57679
const AT = 57375
const BACKUP = 57376
const BCONST = 57348
const BEGIN = 57377
const BETWEEN = 57378
const BIGINT = 57379
const BIGSERIAL = 57380
const BIT = 57381
const BLOB = 57382
const BOOL = 57383
const BOOLEAN = 57384
const BOTH = 57385
const BY = 57386
const BYTEA = 57387
const BYTES = 57388
const CANCEL = 57389
const CASCADE = 57390
const CASE = 57391
const CAST = 57392
const CHAR = 57393
const CHARACTER = 57394
const CHARACTERISTICS = 57395
const CHECK = 57396
const CLUSTER = 57397
const COALESCE = 57398
const COLLATE = 57399
const COLLATION = 57400
const COLUMN = 57401
const COLUMNS = 57402
const COMMIT = 57403
const COMMITTED = 57404
const CONCAT = 57405
const CONFLICT = 57406
const CONSTRAINT = 57407
const CONSTRAINTS = 57408
const COPY = 57409
const COVERING = 57410
const CREATE = 57411
const CROSS = 57412
const CSV = 57413
const CUBE = 57414
const CURRENT = 57415
const CURRENT_CATALOG = 57416
const CURRENT_DATE = 57417
const CURRENT_ROLE = 57419
const CURRENT_SCHEMA = 57418
const CURRENT_TIME = 57420
const CURRENT_TIMESTAMP = 57421
const CURRENT_USER = 57422
const CYCLE = 57423
const DATA = 57424
const DATABASE = 57425
const DATABASES = 57426
const DATE = 57427
const DAY = 57428
const DEALLOCATE = 57432
const DEC = 57429
const DECIMAL = 57430
const DEFAULT = 57431
const DEFERRABLE = 57433
const DELETE = 57434
const DESC = 57435
const DISCARD = 57436
const DISTINCT = 57437
const DO = 57438
const DOT_DOT = 57354
const DOUBLE = 57439
const DROP = 57440
const ELSE = 57441
const ENCODING = 57442
const END = 57443
const ERROR = 57361
const ESCAPE = 57444
const EXCEPT = 57445
const EXECUTE = 57447
const EXISTS = 57446
const EXPERIMENTAL_FINGERPRINTS = 57448
const EXPLAIN = 57449
const EXTRACT = 57450
const EXTRACT_DURATION = 57451
const FALSE = 57452
const FAMILY = 57453
const FCONST = 57350
const FETCH = 57454
const FILTER = 57455
const FIRST = 57456
const FLOAT = 57457
const FLOAT4 = 57458
const FLOAT8 = 57459
const FLOORDIV = 57460
const FOLLOWING = 57461
const FOR = 57462
const FORCE_INDEX = 57463
const FOREIGN = 57464
const FROM = 57465
const FULL = 57466
const GRANT = 57467
const GRANTS = 57468
const GREATER_EQUALS = 57356
const GREATEST = 57469
const GROUP = 57470
const GROUPING = 57471
const HAVING = 57472
const HELP = 57473
const HELPTOKEN = 57682
const HIGH = 57474
const HOUR = 57475
const ICONST = 57349
const IDENT = 57346
const IF = 57478
const IFNULL = 57479
const ILIKE = 57480
const IMPORT = 57476
const IN = 57481
const INCREMENTAL = 57477
const INDEX = 57484
const INDEXES = 57485
const INET = 57482
const INITIALLY = 57486
const INNER = 57487
const INSERT = 57488
const INT = 57489
const INT2 = 57491
const INT2VECTOR = 57490
const INT4 = 57492
const INT64 = 57494
const INT8 = 57493
const INTEGER = 57495
const INTERLEAVE = 57483
const INTERSECT = 57496
const INTERVAL = 57497
const INTO = 57498
const IS = 57499
const ISOLATION = 57500
const InvalidColIdx = -1

InvalidColIdx is the index value of a non-initialized IndexedVar.

const JOB = 57501
const JOBS = 57502
const JOIN = 57503
const KEY = 57504
const KEYS = 57505
const KV = 57506
const LATERAL = 57507
const LC_COLLATE = 57509
const LC_CTYPE = 57508
const LEADING = 57510
const LEAST = 57511
const LEFT = 57512
const LESS_EQUALS = 57355
const LEVEL = 57513
const LIKE = 57514
const LIMIT = 57515
const LOCAL = 57516
const LOCALTIME = 57517
const LOCALTIMESTAMP = 57518
const LOW = 57519
const LSHIFT = 57520
const MATCH = 57521
const MINUTE = 57522
const MONTH = 57523
const MaxInt = int(MaxUint >> 1)

MaxInt is the maximum value of an int.

const MaxUint = ^uint(0)

MaxUint is the maximum value of an uint.

const NAME = 57525
const NAMES = 57526
const NAN = 57524
const NATURAL = 57527
const NEXT = 57528
const NO = 57529
const NORMAL = 57531
const NOT = 57532
const NOTHING = 57533
const NOT_EQUALS = 57357
const NOT_LA = 57677
const NOT_REGIMATCH = 57360
const NOT_REGMATCH = 57358
const NO_INDEX_JOIN = 57530
const NULL = 57534
const NULLIF = 57535
const NULLS = 57536
const NUMERIC = 57537
const OF = 57538
const OFF = 57539
const OFFSET = 57540
const OID = 57541
const ON = 57542
const ONLY = 57543
const OPTIONS = 57544
const OR = 57545
const ORDER = 57546
const ORDINALITY = 57547
const OUT = 57548
const OUTER = 57549
const OVER = 57550
const OVERLAPS = 57551
const OVERLAY = 57552
const PARENT = 57553
const PARTIAL = 57554
const PARTITION = 57555
const PASSWORD = 57556
const PAUSE = 57557
const PLACEHOLDER = 57351
const PLACING = 57558
const PLANS = 57559
const POSITION = 57560
const POSTFIXOP = 57680
const PRECEDING = 57561
const PRECISION = 57562
const PREPARE = 57563
const PRIMARY = 57564
const PRIORITY = 57565
const PgCatalogName = "pg_catalog"

PgCatalogName is the name of the pg_catalog system database.

const QUERIES = 57566
const QUERY = 57567
const RANGE = 57568
const READ = 57569
const REAL = 57570
const RECURSIVE = 57571
const REF = 57572
const REFERENCES = 57573
const REGCLASS = 57574
const REGIMATCH = 57359
const REGNAMESPACE = 57577
const REGPROC = 57575
const REGPROCEDURE = 57576
const REGTYPE = 57578
const RELEASE = 57581
const RENAME = 57579
const REPEATABLE = 57580
const RESET = 57582
const RESTORE = 57583
const RESTRICT = 57584
const RESUME = 57585
const RETURNING = 57586
const REVOKE = 57587
const RIGHT = 57588
const ROLLBACK = 57589
const ROLLUP = 57590
const ROW = 57591
const ROWS = 57592
const RSHIFT = 57593
const RestartSavepointName string = "COCKROACH_RESTART"

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

const SAVEPOINT = 57594
const SCATTER = 57595
const SCONST = 57347
const SEARCH = 57596
const SECOND = 57597
const SELECT = 57598
const SEQUENCES = 57599
const SERIAL = 57600
const SERIALIZABLE = 57601
const SESSION = 57602
const SESSIONS = 57603
const SESSION_USER = 57604
const SET = 57605
const SETTING = 57606
const SETTINGS = 57607
const SHOW = 57608
const SIMILAR = 57609
const SIMPLE = 57610
const SMALLINT = 57611
const SMALLSERIAL = 57612
const SNAPSHOT = 57613
const SOME = 57614
const SPLIT = 57615
const SQL = 57616
const START = 57617
const STATUS = 57618
const STDIN = 57619
const STORE = 57622
const STORING = 57623
const STRICT = 57620
const STRING = 57621
const SUBSTRING = 57624
const SYMMETRIC = 57625
const SYSTEM = 57626
const TABLE = 57627
const TABLES = 57628
const TEMP = 57629
const TEMPLATE = 57630
const TEMPORARY = 57631
const TESTING_RANGES = 57632
const TESTING_RELOCATE = 57633
const TEXT = 57634
const THEN = 57635
const TIME = 57636
const TIMESTAMP = 57637
const TIMESTAMPTZ = 57638
const TO = 57639
const TRACE = 57641
const TRAILING = 57640
const TRANSACTION = 57642
const TREAT = 57643
const TRIM = 57644
const TRUE = 57645
const TRUNCATE = 57646
const TYPE = 57647
const TYPEANNOTATE = 57353
const TYPECAST = 57352
const (

    // TimestampOutputFormat is used to output all timestamps.
    TimestampOutputFormat = "2006-01-02 15:04:05.999999-07:00"
)

time.Time formats.

const UMINUS = 57681
const UNBOUNDED = 57648
const UNCOMMITTED = 57649
const UNION = 57650
const UNIQUE = 57651
const UNKNOWN = 57652
const UPDATE = 57653
const UPSERT = 57654
const USE = 57655
const USER = 57656
const USERS = 57657
const USING = 57658
const UUID = 57659
const VALID = 57660
const VALIDATE = 57661
const VALUE = 57662
const VALUES = 57663
const VARCHAR = 57664
const VARIADIC = 57665
const VARYING = 57667
const VIEW = 57666
const WHEN = 57668
const WHERE = 57669
const WINDOW = 57670
const WITH = 57671
const WITHIN = 57672
const WITHOUT = 57673
const WITH_LA = 57678
const WRITE = 57674
const YEAR = 57675
const ZONE = 57676

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{}

    // DZero is the zero-valued integer Datum.
    DZero = NewDInt(0)
)
var (
    // DecimalCtx is the default context for decimal operations. Any change
    // in the exponent limits must still guarantee a safe conversion to the
    // postegrs binary decimal format in the wire protocol, which uses an
    // int16. See pgwire/types.go.
    DecimalCtx = &apd.Context{
        Precision:   20,
        Rounding:    apd.RoundHalfUp,
        MaxExponent: 2000,
        MinExponent: -2000,
        Traps:       apd.DefaultTraps,
    }
    // ExactCtx is a decimal context with exact precision.
    ExactCtx = DecimalCtx.WithPrecision(0)
    // HighPrecisionCtx is a decimal context with high precision.
    HighPrecisionCtx = DecimalCtx.WithPrecision(2000)
    // RoundCtx is a decimal context with high precision and RoundHalfEven
    // rounding.
    RoundCtx = func() *apd.Context {
        ctx := *HighPrecisionCtx
        ctx.Rounding = apd.RoundHalfEven
        return &ctx
    }()
)
var (
    // DatEncodingUTFId is the encoding ID for our only supported database
    // encoding, UTF8.
    DatEncodingUTFId = NewDInt(6)
    // DatEncodingEnUTF8 is the encoding name for our only supported database
    // encoding, UTF8.
    DatEncodingEnUTF8 = NewDString("en_US.utf8")
)

http://doxygen.postgresql.org/pg__wchar_8h.html#a22e0c8b9f59f6e226a5968620b4bb6a9aac3b065b882d3231ba59297524da2f23

var (
    // TypeNull is the type of a DNull. Can be compared with ==.
    TypeNull Type = tNull{}
    // TypeBool is the type of a DBool. Can be compared with ==.
    TypeBool Type = tBool{}
    // TypeInt is the type of a DInt. Can be compared with ==.
    TypeInt Type = tInt{}
    // TypeFloat is the type of a DFloat. Can be compared with ==.
    TypeFloat Type = tFloat{}
    // TypeDecimal is the type of a DDecimal. Can be compared with ==.
    TypeDecimal Type = tDecimal{}
    // TypeString is the type of a DString. Can be compared with ==.
    TypeString Type = tString{}
    // TypeCollatedString is the type family of a DString. CANNOT be compared with
    // ==.
    TypeCollatedString Type = TCollatedString{}
    // TypeBytes is the type of a DBytes. Can be compared with ==.
    TypeBytes Type = tBytes{}
    // TypeDate is the type of a DDate. Can be compared with ==.
    TypeDate Type = tDate{}
    // TypeTimestamp is the type of a DTimestamp. Can be compared with ==.
    TypeTimestamp Type = tTimestamp{}
    // TypeTimestampTZ is the type of a DTimestampTZ. Can be compared with ==.
    TypeTimestampTZ Type = tTimestampTZ{}
    // TypeInterval is the type of a DInterval. Can be compared with ==.
    TypeInterval Type = tInterval{}
    // TypeUUID is the type of a DUuid. Can be compared with ==.
    TypeUUID Type = tUUID{}
    // TypeINet is the type of a DIPAddr. Can be compared with ==.
    TypeINet Type = tINet{}
    // TypeTuple is the type family of a DTuple. CANNOT be compared with ==.
    TypeTuple Type = TTuple(nil)
    // TypeArray is the type family of a DArray. CANNOT be compared with ==.
    TypeArray Type = TArray{}
    // TypeTable is the type family of a DTable. CANNOT be compared with ==.
    TypeTable Type = TTable{}
    // TypePlaceholder is the type family of a placeholder. CANNOT be compared
    // with ==.
    TypePlaceholder Type = TPlaceholder{}
    // TypeAnyArray is the type of a DArray with a wildcard parameterized type.
    // Can be compared with ==.
    TypeAnyArray Type = TArray{TypeAny}
    // TypeAny can be any type. Can be compared with ==.
    TypeAny Type = tAny{}

    // TypeOid is the type of an OID. Can be compared with ==.
    TypeOid = tOid{oid.T_oid}
    // TypeRegClass is the type of an regclass OID variant. Can be compared with ==.
    TypeRegClass = tOid{oid.T_regclass}
    // TypeRegNamespace is the type of an regnamespace OID variant. Can be compared with ==.
    TypeRegNamespace = tOid{oid.T_regnamespace}
    // TypeRegProc is the type of an regproc OID variant. Can be compared with ==.
    TypeRegProc = tOid{oid.T_regproc}
    // TypeRegProcedure is the type of an regprocedure OID variant. Can be compared with ==.
    TypeRegProcedure = tOid{oid.T_regprocedure}
    // TypeRegType is the type of an regtype OID variant. Can be compared with ==.
    TypeRegType = tOid{oid.T_regtype}

    // TypeName is a type-alias for TypeString with a different OID. Can be
    // compared with ==.
    TypeName = wrapTypeWithOid(TypeString, oid.T_name)
    // TypeIntVector is a type-alias for a TypeIntArray with a different OID. Can
    // be compared with ==.
    TypeIntVector = wrapTypeWithOid(TArray{TypeInt}, oid.T_int2vector)
    // TypeNameArray is the type family of a DArray containing the Name alias type.
    // Can be compared with ==.
    TypeNameArray Type = TArray{TypeName}

    // TypesAnyNonArray contains all non-array types.
    TypesAnyNonArray = []Type{
        TypeBool,
        TypeInt,
        TypeFloat,
        TypeDecimal,
        TypeString,
        TypeBytes,
        TypeDate,
        TypeTimestamp,
        TypeTimestampTZ,
        TypeInterval,
        TypeUUID,
        TypeINet,
        TypeOid,
    }
)
var AbsentReturningClause = &NoReturningClause{}

AbsentReturningClause is a ReturningClause variant representing the absence of a RETURNING clause.

var Aggregates = map[string][]Builtin{
    "array_agg": {
        makeAggBuiltinWithReturnType(
            []Type{TypeAny},
            func(args []TypedExpr) Type {
                if len(args) == 0 {
                    return unknownReturnType
                }
                return TArray{args[0].ResolvedType()}
            },
            newArrayAggregate,
            "Aggregates the selected values into an array.",
        ),
    },

    "avg": {
        makeAggBuiltin([]Type{TypeInt}, TypeDecimal, newIntAvgAggregate,
            "Calculates the average of the selected values."),
        makeAggBuiltin([]Type{TypeFloat}, TypeFloat, newFloatAvgAggregate,
            "Calculates the average of the selected values."),
        makeAggBuiltin([]Type{TypeDecimal}, TypeDecimal, newDecimalAvgAggregate,
            "Calculates the average of the selected values."),
    },

    "bool_and": {
        makeAggBuiltin([]Type{TypeBool}, TypeBool, newBoolAndAggregate,
            "Calculates the boolean value of `AND`ing all selected values."),
    },

    "bool_or": {
        makeAggBuiltin([]Type{TypeBool}, TypeBool, newBoolOrAggregate,
            "Calculates the boolean value of `OR`ing all selected values."),
    },

    "concat_agg": {

        makeAggBuiltin([]Type{TypeString}, TypeString, newStringConcatAggregate,
            "Concatenates all selected values."),
        makeAggBuiltin([]Type{TypeBytes}, TypeBytes, newBytesConcatAggregate,
            "Concatenates all selected values."),
    },

    "count": {
        makeAggBuiltin([]Type{TypeAny}, TypeInt, newCountAggregate,
            "Calculates the number of selected elements."),
    },

    "count_rows": {
        {
            impure:        true,
            class:         AggregateClass,
            Types:         ArgTypes{},
            ReturnType:    fixedReturnType(TypeInt),
            AggregateFunc: newCountRowsAggregate,
            WindowFunc: func(params []Type, evalCtx *EvalContext) WindowFunc {
                return newAggregateWindow(newCountRowsAggregate(params, evalCtx))
            },
            Info: "Calculates the number of rows.",
        },
    },

    "max": collectBuiltins(func(t Type) Builtin {
        return makeAggBuiltin([]Type{t}, t, newMaxAggregate,
            "Identifies the maximum selected value.")
    }, TypesAnyNonArray...),
    "min": collectBuiltins(func(t Type) Builtin {
        return makeAggBuiltin([]Type{t}, t, newMinAggregate,
            "Identifies the minimum selected value.")
    }, TypesAnyNonArray...),

    "sum_int": {
        makeAggBuiltin([]Type{TypeInt}, TypeInt, newSmallIntSumAggregate,
            "Calculates the sum of the selected values."),
    },

    "sum": {
        makeAggBuiltin([]Type{TypeInt}, TypeDecimal, newIntSumAggregate,
            "Calculates the sum of the selected values."),
        makeAggBuiltin([]Type{TypeFloat}, TypeFloat, newFloatSumAggregate,
            "Calculates the sum of the selected values."),
        makeAggBuiltin([]Type{TypeDecimal}, TypeDecimal, newDecimalSumAggregate,
            "Calculates the sum of the selected values."),
        makeAggBuiltin([]Type{TypeInterval}, TypeInterval, newIntervalSumAggregate,
            "Calculates the sum of the selected values."),
    },

    "sqrdiff": {
        makeAggBuiltin([]Type{TypeInt}, TypeDecimal, newIntSqrDiffAggregate,
            "Calculates the sum of squared differences from the mean of the selected values."),
        makeAggBuiltin([]Type{TypeDecimal}, TypeDecimal, newDecimalSqrDiffAggregate,
            "Calculates the sum of squared differences from the mean of the selected values."),
        makeAggBuiltin([]Type{TypeFloat}, TypeFloat, newFloatSqrDiffAggregate,
            "Calculates the sum of squared differences from the mean of the selected values."),
    },

    "final_variance": {
        makeAggBuiltin([]Type{TypeDecimal, TypeDecimal, TypeInt}, TypeDecimal, newDecimalFinalVarianceAggregate,
            "Calculates the variance from the selected locally-computed squared difference values."),
        makeAggBuiltin([]Type{TypeFloat, TypeFloat, TypeInt}, TypeFloat, newFloatFinalVarianceAggregate,
            "Calculates the variance from the selected locally-computed squared difference values."),
    },

    "final_stddev": {
        makeAggBuiltin([]Type{TypeDecimal, TypeDecimal, TypeInt}, TypeDecimal, newDecimalFinalStdDevAggregate,
            "Calculates the standard deviation from the selected locally-computed squared difference values."),
        makeAggBuiltin([]Type{TypeFloat, TypeFloat, TypeInt}, TypeFloat, newFloatFinalStdDevAggregate,
            "Calculates the standard deviation from the selected locally-computed squared difference values."),
    },

    "variance": {
        makeAggBuiltin([]Type{TypeInt}, TypeDecimal, newIntVarianceAggregate,
            "Calculates the variance of the selected values."),
        makeAggBuiltin([]Type{TypeDecimal}, TypeDecimal, newDecimalVarianceAggregate,
            "Calculates the variance of the selected values."),
        makeAggBuiltin([]Type{TypeFloat}, TypeFloat, newFloatVarianceAggregate,
            "Calculates the variance of the selected values."),
    },

    "stddev": {
        makeAggBuiltin([]Type{TypeInt}, TypeDecimal, newIntStdDevAggregate,
            "Calculates the standard deviation of the selected values."),
        makeAggBuiltin([]Type{TypeDecimal}, TypeDecimal, newDecimalStdDevAggregate,
            "Calculates the standard deviation of the selected values."),
        makeAggBuiltin([]Type{TypeFloat}, TypeFloat, newFloatStdDevAggregate,
            "Calculates the standard deviation of the selected values."),
    },

    "xor_agg": {
        makeAggBuiltin([]Type{TypeBytes}, TypeBytes, newBytesXorAggregate,
            "Calculates the bitwise XOR of the selected values."),
        makeAggBuiltin([]Type{TypeInt}, TypeInt, newIntXorAggregate,
            "Calculates the bitwise XOR of the selected values."),
    },
}

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 package. 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. Exported for use in documentation.

var AllBuiltinNames []string

AllBuiltinNames is an array containing all the built-in function names, sorted in alphabetical order. This can be used for a deterministic walk through the Builtins map.

var AllHelp = func(h map[string]HelpMessageBody) string {

    cmds := make(map[string][]string)
    for c, details := range h {
        if details.Category == "" {
            continue
        }
        cmds[details.Category] = append(cmds[details.Category], c)
    }

    // Ensure the result is deterministic.
    var categories []string
    for c, l := range cmds {
        categories = append(categories, c)
        sort.Strings(l)
    }
    sort.Strings(categories)

    // Compile the final help index.
    var buf bytes.Buffer
    w := tabwriter.NewWriter(&buf, 0, 0, 1, ' ', 0)
    for _, cat := range categories {
        fmt.Fprintf(w, "%s:\n", strings.Title(cat))
        for _, item := range cmds[cat] {
            fmt.Fprintf(w, "\t\t%s\t%s\n", item, h[item].ShortDescription)
        }
        fmt.Fprintln(w)
    }
    _ = w.Flush()
    return buf.String()
}(helpMessages)

AllHelp contains an overview of all statements with help messages. For example, displayed in the CLI shell with \h without additional parameters.

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

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

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

    Plus: {
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeInt,
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                a, b := MustBeDInt(left), MustBeDInt(right)
                r, ok := addWithOverflow(int64(a), int64(b))
                if !ok {
                    return nil, errIntOutOfRange
                }
                return NewDInt(DInt(r)), 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).Decimal
                r := &right.(*DDecimal).Decimal
                dd := &DDecimal{}
                _, err := ExactCtx.Add(&dd.Decimal, l, r)
                return dd, err
            },
        },
        BinOp{
            LeftType:   TypeDecimal,
            RightType:  TypeInt,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := &left.(*DDecimal).Decimal
                r := MustBeDInt(right)
                dd := &DDecimal{}
                dd.SetCoefficient(int64(r))
                _, err := ExactCtx.Add(&dd.Decimal, l, &dd.Decimal)
                return dd, err
            },
        },
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeDecimal,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := MustBeDInt(left)
                r := &right.(*DDecimal).Decimal
                dd := &DDecimal{}
                dd.SetCoefficient(int64(l))
                _, err := ExactCtx.Add(&dd.Decimal, &dd.Decimal, r)
                return dd, err
            },
        },
        BinOp{
            LeftType:   TypeDate,
            RightType:  TypeInt,
            ReturnType: TypeDate,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDDate(*left.(*DDate) + DDate(MustBeDInt(right))), nil
            },
        },
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeDate,
            ReturnType: TypeDate,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDDate(DDate(MustBeDInt(left)) + *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
            },
        },
        BinOp{
            LeftType:   TypeDate,
            RightType:  TypeInterval,
            ReturnType: TypeTimestampTZ,
            fn: func(ctx *EvalContext, left Datum, right Datum) (Datum, error) {
                leftTZ := MakeDTimestampTZFromDate(ctx.GetLocation(), left.(*DDate))
                t := duration.Add(leftTZ.Time, right.(*DInterval).Duration)
                return MakeDTimestampTZ(t, time.Microsecond), nil
            },
        },
        BinOp{
            LeftType:   TypeInterval,
            RightType:  TypeDate,
            ReturnType: TypeTimestampTZ,
            fn: func(ctx *EvalContext, left Datum, right Datum) (Datum, error) {
                rightTZ := MakeDTimestampTZFromDate(ctx.GetLocation(), right.(*DDate))
                t := duration.Add(rightTZ.Time, left.(*DInterval).Duration)
                return MakeDTimestampTZ(t, time.Microsecond), nil
            },
        },
    },

    Minus: {
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeInt,
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                a, b := MustBeDInt(left), MustBeDInt(right)
                if b < 0 && a > math.MaxInt64+b {
                    return nil, errIntOutOfRange
                }
                if b > 0 && a < math.MinInt64+b {
                    return nil, errIntOutOfRange
                }
                return NewDInt(a - b), 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).Decimal
                r := &right.(*DDecimal).Decimal
                dd := &DDecimal{}
                _, err := ExactCtx.Sub(&dd.Decimal, l, r)
                return dd, err
            },
        },
        BinOp{
            LeftType:   TypeDecimal,
            RightType:  TypeInt,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := &left.(*DDecimal).Decimal
                r := MustBeDInt(right)
                dd := &DDecimal{}
                dd.SetCoefficient(int64(r))
                _, err := ExactCtx.Sub(&dd.Decimal, l, &dd.Decimal)
                return dd, err
            },
        },
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeDecimal,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := MustBeDInt(left)
                r := &right.(*DDecimal).Decimal
                dd := &DDecimal{}
                dd.SetCoefficient(int64(l))
                _, err := ExactCtx.Sub(&dd.Decimal, &dd.Decimal, r)
                return dd, err
            },
        },
        BinOp{
            LeftType:   TypeDate,
            RightType:  TypeInt,
            ReturnType: TypeDate,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDDate(*left.(*DDate) - DDate(MustBeDInt(right))), 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:  TypeTimestampTZ,
            ReturnType: TypeInterval,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                nanos := left.(*DTimestamp).Sub(right.(*DTimestampTZ).Time).Nanoseconds()
                return &DInterval{Duration: duration.Duration{Nanos: nanos}}, nil
            },
        },
        BinOp{
            LeftType:   TypeTimestampTZ,
            RightType:  TypeTimestamp,
            ReturnType: TypeInterval,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                nanos := left.(*DTimestampTZ).Sub(right.(*DTimestamp).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:   TypeDate,
            RightType:  TypeInterval,
            ReturnType: TypeTimestampTZ,
            fn: func(ctx *EvalContext, left Datum, right Datum) (Datum, error) {
                leftTZ := MakeDTimestampTZFromDate(ctx.GetLocation(), left.(*DDate))
                t := duration.Add(leftTZ.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) {

                a, b := MustBeDInt(left), MustBeDInt(right)
                c := a * b
                if a == 0 || b == 0 || a == 1 || b == 1 {

                } else if a == math.MinInt64 || b == math.MinInt64 {

                    return nil, errIntOutOfRange
                } else if c/b != a {
                    return nil, errIntOutOfRange
                }
                return NewDInt(c), 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).Decimal
                r := &right.(*DDecimal).Decimal
                dd := &DDecimal{}
                _, err := ExactCtx.Mul(&dd.Decimal, l, r)
                return dd, err
            },
        },

        BinOp{
            LeftType:   TypeDecimal,
            RightType:  TypeInt,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := &left.(*DDecimal).Decimal
                r := MustBeDInt(right)
                dd := &DDecimal{}
                dd.SetCoefficient(int64(r))
                _, err := ExactCtx.Mul(&dd.Decimal, l, &dd.Decimal)
                return dd, err
            },
        },
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeDecimal,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := MustBeDInt(left)
                r := &right.(*DDecimal).Decimal
                dd := &DDecimal{}
                dd.SetCoefficient(int64(l))
                _, err := ExactCtx.Mul(&dd.Decimal, &dd.Decimal, r)
                return dd, err
            },
        },
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeInterval,
            ReturnType: TypeInterval,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return &DInterval{Duration: right.(*DInterval).Duration.Mul(int64(MustBeDInt(left)))}, 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(MustBeDInt(right)))}, nil
            },
        },
        BinOp{
            LeftType:   TypeInterval,
            RightType:  TypeFloat,
            ReturnType: TypeInterval,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                r := float64(*right.(*DFloat))
                return &DInterval{Duration: left.(*DInterval).Duration.MulFloat(r)}, nil
            },
        },
    },

    Div: {
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeInt,
            ReturnType: TypeDecimal,
            fn: func(ctx *EvalContext, left Datum, right Datum) (Datum, error) {
                rInt := MustBeDInt(right)
                div := ctx.getTmpDec().SetCoefficient(int64(rInt)).SetExponent(0)
                dd := &DDecimal{}
                dd.SetCoefficient(int64(MustBeDInt(left)))
                _, err := DecimalCtx.Quo(&dd.Decimal, &dd.Decimal, div)
                return dd, err
            },
        },
        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).Decimal
                r := &right.(*DDecimal).Decimal
                dd := &DDecimal{}
                _, err := DecimalCtx.Quo(&dd.Decimal, l, r)
                return dd, err
            },
        },
        BinOp{
            LeftType:   TypeDecimal,
            RightType:  TypeInt,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := &left.(*DDecimal).Decimal
                r := MustBeDInt(right)
                dd := &DDecimal{}
                dd.SetCoefficient(int64(r))
                _, err := DecimalCtx.Quo(&dd.Decimal, l, &dd.Decimal)
                return dd, err
            },
        },
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeDecimal,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := MustBeDInt(left)
                r := &right.(*DDecimal).Decimal
                dd := &DDecimal{}
                dd.SetCoefficient(int64(l))
                _, err := DecimalCtx.Quo(&dd.Decimal, &dd.Decimal, r)
                return dd, err
            },
        },
        BinOp{
            LeftType:   TypeInterval,
            RightType:  TypeInt,
            ReturnType: TypeInterval,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                rInt := MustBeDInt(right)
                if rInt == 0 {
                    return nil, errDivByZero
                }
                return &DInterval{Duration: left.(*DInterval).Duration.Div(int64(rInt))}, nil
            },
        },
        BinOp{
            LeftType:   TypeInterval,
            RightType:  TypeFloat,
            ReturnType: TypeInterval,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                r := float64(*right.(*DFloat))
                if r == 0.0 {
                    return nil, errDivByZero
                }
                return &DInterval{Duration: left.(*DInterval).Duration.DivFloat(r)}, nil
            },
        },
    },

    FloorDiv: {
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeInt,
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                rInt := MustBeDInt(right)
                if rInt == 0 {
                    return nil, errDivByZero
                }
                return NewDInt(MustBeDInt(left) / 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).Decimal
                r := &right.(*DDecimal).Decimal
                dd := &DDecimal{}
                _, err := HighPrecisionCtx.QuoInteger(&dd.Decimal, l, r)
                return dd, err
            },
        },
        BinOp{
            LeftType:   TypeDecimal,
            RightType:  TypeInt,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := &left.(*DDecimal).Decimal
                r := MustBeDInt(right)
                if r == 0 {
                    return nil, errDivByZero
                }
                dd := &DDecimal{}
                dd.SetCoefficient(int64(r))
                _, err := HighPrecisionCtx.QuoInteger(&dd.Decimal, l, &dd.Decimal)
                return dd, err
            },
        },
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeDecimal,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := MustBeDInt(left)
                r := &right.(*DDecimal).Decimal
                if r.Sign() == 0 {
                    return nil, errDivByZero
                }
                dd := &DDecimal{}
                dd.SetCoefficient(int64(l))
                _, err := HighPrecisionCtx.QuoInteger(&dd.Decimal, &dd.Decimal, r)
                return dd, err
            },
        },
    },

    Mod: {
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeInt,
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                r := MustBeDInt(right)
                if r == 0 {
                    return nil, errZeroModulus
                }
                return NewDInt(MustBeDInt(left) % 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).Decimal
                r := &right.(*DDecimal).Decimal
                dd := &DDecimal{}
                _, err := HighPrecisionCtx.Rem(&dd.Decimal, l, r)
                return dd, err
            },
        },
        BinOp{
            LeftType:   TypeDecimal,
            RightType:  TypeInt,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := &left.(*DDecimal).Decimal
                r := MustBeDInt(right)
                dd := &DDecimal{}
                dd.SetCoefficient(int64(r))
                _, err := HighPrecisionCtx.Rem(&dd.Decimal, l, &dd.Decimal)
                return dd, err
            },
        },
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeDecimal,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := MustBeDInt(left)
                r := &right.(*DDecimal).Decimal
                dd := &DDecimal{}
                dd.SetCoefficient(int64(l))
                _, err := HighPrecisionCtx.Rem(&dd.Decimal, &dd.Decimal, r)
                return dd, err
            },
        },
    },

    Concat: {
        BinOp{
            LeftType:   TypeString,
            RightType:  TypeString,
            ReturnType: TypeString,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                return NewDString(string(MustBeDString(left) + MustBeDString(right))), 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(MustBeDInt(left) << uint(MustBeDInt(right))), nil
            },
        },
    },

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

    Pow: {
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeInt,
            ReturnType: TypeInt,
            fn: func(ctx *EvalContext, left Datum, right Datum) (Datum, error) {
                return intPow(MustBeDInt(left), MustBeDInt(right))
            },
        },
        BinOp{
            LeftType:   TypeFloat,
            RightType:  TypeFloat,
            ReturnType: TypeFloat,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                f := math.Pow(float64(*left.(*DFloat)), float64(*right.(*DFloat)))
                return NewDFloat(DFloat(f)), nil
            },
        },
        BinOp{
            LeftType:   TypeDecimal,
            RightType:  TypeDecimal,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := &left.(*DDecimal).Decimal
                r := &right.(*DDecimal).Decimal
                dd := &DDecimal{}
                _, err := DecimalCtx.Pow(&dd.Decimal, l, r)
                return dd, err
            },
        },
        BinOp{
            LeftType:   TypeDecimal,
            RightType:  TypeInt,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := &left.(*DDecimal).Decimal
                r := MustBeDInt(right)
                dd := &DDecimal{}
                dd.SetCoefficient(int64(r))
                _, err := DecimalCtx.Pow(&dd.Decimal, l, &dd.Decimal)
                return dd, err
            },
        },
        BinOp{
            LeftType:   TypeInt,
            RightType:  TypeDecimal,
            ReturnType: TypeDecimal,
            fn: func(_ *EvalContext, left Datum, right Datum) (Datum, error) {
                l := MustBeDInt(left)
                r := &right.(*DDecimal).Decimal
                dd := &DDecimal{}
                dd.SetCoefficient(int64(l))
                _, err := DecimalCtx.Pow(&dd.Decimal, &dd.Decimal, r)
                return dd, err
            },
        },
    },
}

BinOps contains the binary operations indexed by operation type.

var Builtins = map[string][]Builtin{ /* 108 elements not displayed */

}

Builtins contains the built-in functions indexed by name.

var CmpOps = map[ComparisonOperator]cmpOpOverload{
    EQ: {
        CmpOp{
            LeftType:  TypeString,
            RightType: TypeString,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeCollatedString,
            RightType: TypeCollatedString,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeBytes,
            RightType: TypeBytes,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeBool,
            RightType: TypeBool,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeInt,
            RightType: TypeInt,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeFloat,
            RightType: TypeFloat,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeDecimal,
            RightType: TypeDecimal,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeFloat,
            RightType: TypeInt,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeInt,
            RightType: TypeFloat,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeDecimal,
            RightType: TypeInt,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeInt,
            RightType: TypeDecimal,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeDecimal,
            RightType: TypeFloat,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeFloat,
            RightType: TypeDecimal,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeDate,
            RightType: TypeDate,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeTimestamp,
            RightType: TypeTimestamp,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeTimestampTZ,
            RightType: TypeTimestampTZ,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeTimestamp,
            RightType: TypeTimestampTZ,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeTimestampTZ,
            RightType: TypeTimestamp,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeDate,
            RightType: TypeTimestampTZ,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeDate,
            RightType: TypeTimestamp,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeTimestampTZ,
            RightType: TypeDate,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeTimestamp,
            RightType: TypeDate,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeInterval,
            RightType: TypeInterval,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeUUID,
            RightType: TypeUUID,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeINet,
            RightType: TypeINet,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeOid,
            RightType: TypeOid,
            fn:        cmpOpScalarEQFn,
        },
        CmpOp{
            LeftType:  TypeTuple,
            RightType: TypeTuple,
            fn: func(ctx *EvalContext, left Datum, right Datum) (Datum, error) {
                return cmpOpTupleFn(ctx, *left.(*DTuple), *right.(*DTuple), EQ), nil
            },
        },
    },

    LT: {
        CmpOp{
            LeftType:  TypeString,
            RightType: TypeString,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeCollatedString,
            RightType: TypeCollatedString,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeBytes,
            RightType: TypeBytes,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeBool,
            RightType: TypeBool,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeInt,
            RightType: TypeInt,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeFloat,
            RightType: TypeFloat,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeDecimal,
            RightType: TypeDecimal,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeFloat,
            RightType: TypeInt,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeInt,
            RightType: TypeFloat,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeDecimal,
            RightType: TypeInt,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeInt,
            RightType: TypeDecimal,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeDecimal,
            RightType: TypeFloat,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeFloat,
            RightType: TypeDecimal,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeDate,
            RightType: TypeDate,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeTimestamp,
            RightType: TypeTimestamp,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeTimestampTZ,
            RightType: TypeTimestampTZ,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeTimestamp,
            RightType: TypeTimestampTZ,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeTimestampTZ,
            RightType: TypeTimestamp,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeDate,
            RightType: TypeTimestampTZ,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeDate,
            RightType: TypeTimestamp,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeTimestampTZ,
            RightType: TypeDate,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeTimestamp,
            RightType: TypeDate,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeInterval,
            RightType: TypeInterval,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeUUID,
            RightType: TypeUUID,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeINet,
            RightType: TypeINet,
            fn:        cmpOpScalarLTFn,
        },
        CmpOp{
            LeftType:  TypeTuple,
            RightType: TypeTuple,
            fn: func(ctx *EvalContext, left Datum, right Datum) (Datum, error) {
                return cmpOpTupleFn(ctx, *left.(*DTuple), *right.(*DTuple), LT), nil
            },
        },
    },

    LE: {
        CmpOp{
            LeftType:  TypeString,
            RightType: TypeString,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeCollatedString,
            RightType: TypeCollatedString,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeBytes,
            RightType: TypeBytes,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeBool,
            RightType: TypeBool,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeInt,
            RightType: TypeInt,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeFloat,
            RightType: TypeFloat,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeDecimal,
            RightType: TypeDecimal,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeFloat,
            RightType: TypeInt,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeInt,
            RightType: TypeFloat,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeDecimal,
            RightType: TypeInt,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeInt,
            RightType: TypeDecimal,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeDecimal,
            RightType: TypeFloat,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeFloat,
            RightType: TypeDecimal,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeDate,
            RightType: TypeDate,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeTimestamp,
            RightType: TypeTimestamp,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeTimestampTZ,
            RightType: TypeTimestampTZ,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeTimestampTZ,
            RightType: TypeTimestamp,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeTimestamp,
            RightType: TypeTimestampTZ,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeDate,
            RightType: TypeTimestampTZ,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeDate,
            RightType: TypeTimestamp,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeTimestampTZ,
            RightType: TypeDate,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeTimestamp,
            RightType: TypeDate,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeInterval,
            RightType: TypeInterval,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeUUID,
            RightType: TypeUUID,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeINet,
            RightType: TypeINet,
            fn:        cmpOpScalarLEFn,
        },
        CmpOp{
            LeftType:  TypeTuple,
            RightType: TypeTuple,
            fn: func(ctx *EvalContext, left Datum, right Datum) (Datum, error) {
                return cmpOpTupleFn(ctx, *left.(*DTuple), *right.(*DTuple), LE), nil
            },
        },
    },

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

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

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

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

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

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

CmpOps contains the comparison operations indexed by operation type.

var Generators = map[string][]Builtin{
    "generate_series": {
        makeGeneratorBuiltin(
            ArgTypes{{"start", TypeInt}, {"end", TypeInt}},
            TTuple{TypeInt},
            makeSeriesGenerator,
            "Produces a virtual table containing the integer values from `start` to `end`, inclusive.",
        ),
        makeGeneratorBuiltin(
            ArgTypes{{"start", TypeInt}, {"end", TypeInt}, {"step", TypeInt}},
            TTuple{TypeInt},
            makeSeriesGenerator,
            "Produces a virtual table containing the integer values from `start` to `end`, inclusive, by increment of `step`.",
        ),
    },
    "unnest": {
        makeGeneratorBuiltinWithReturnType(
            ArgTypes{{"input", TypeAnyArray}},
            func(args []TypedExpr) Type {
                if len(args) == 0 {
                    return unknownReturnType
                }
                return TTable{Cols: TTuple{args[0].ResolvedType().(TArray).Typ}}
            },
            makeArrayGenerator,
            "Returns the input array as a set of rows",
        ),
    },
}

Generators is a map from name to slice of Builtins for all built-in generators.

var HelpMessages = func(h map[string]HelpMessageBody) map[string]HelpMessageBody {
    appendSeeAlso := func(newItem, prevItems string) string {

        if prevItems != "" {
            return newItem + "\n  " + prevItems
        }
        return newItem
    }
    reformatSeeAlso := func(seeAlso string) string {
        return strings.Replace(
            strings.Replace(seeAlso, ", ", "\n  ", -1),
            "WEBDOCS", docsURLBase, -1)
    }
    srcMsg := h["<SOURCE>"]
    srcMsg.SeeAlso = reformatSeeAlso(strings.TrimSpace(srcMsg.SeeAlso))
    selectMsg := h["<SELECTCLAUSE>"]
    selectMsg.SeeAlso = reformatSeeAlso(strings.TrimSpace(selectMsg.SeeAlso))
    for k, m := range h {
        m = h[k]
        m.ShortDescription = strings.TrimSpace(m.ShortDescription)
        m.Text = strings.TrimSpace(m.Text)
        m.SeeAlso = strings.TrimSpace(m.SeeAlso)

        if strings.Contains(m.Text, "<source>") && k != "<SOURCE>" {
            m.Text = strings.TrimSpace(m.Text) + "\n\n" + strings.TrimSpace(srcMsg.Text)
            m.SeeAlso = appendSeeAlso(srcMsg.SeeAlso, m.SeeAlso)
        }

        if strings.Contains(m.Text, "<selectclause>") && k != "<SELECTCLAUSE>" {
            m.Text = strings.TrimSpace(m.Text) + "\n\n" + strings.TrimSpace(selectMsg.Text)
            m.SeeAlso = appendSeeAlso(selectMsg.SeeAlso, m.SeeAlso)
        }

        if strings.Contains(m.Text, "<tablename>") {
            m.SeeAlso = appendSeeAlso("SHOW TABLES", m.SeeAlso)
        }
        m.SeeAlso = reformatSeeAlso(m.SeeAlso)
        h[k] = m
    }
    return h
}(helpMessages)

HelpMessages is the registry of all help messages, keyed by the top-level statement that they document. The key is intended for use via the \h client-side command.

var OidToType = map[oid.Oid]Type{
    oid.T_anyelement:   TypeAny,
    oid.T_bool:         TypeBool,
    oid.T_bytea:        TypeBytes,
    oid.T_date:         TypeDate,
    oid.T_float4:       typeFloat4,
    oid.T_float8:       TypeFloat,
    oid.T_int2:         typeInt2,
    oid.T_int4:         typeInt4,
    oid.T_int8:         TypeInt,
    oid.T_int2vector:   TypeIntVector,
    oid.T_interval:     TypeInterval,
    oid.T_name:         TypeName,
    oid.T_numeric:      TypeDecimal,
    oid.T_oid:          TypeOid,
    oid.T_regclass:     TypeRegClass,
    oid.T_regnamespace: TypeRegNamespace,
    oid.T_regproc:      TypeRegProc,
    oid.T_regprocedure: TypeRegProcedure,
    oid.T_regtype:      TypeRegType,
    oid.T__text:        TArray{TypeString},
    oid.T__int2:        typeInt2Array,
    oid.T__int4:        typeInt4Array,
    oid.T__int8:        TArray{TypeInt},
    oid.T_record:       TypeTuple,
    oid.T_text:         TypeString,
    oid.T_timestamp:    TypeTimestamp,
    oid.T_timestamptz:  TypeTimestampTZ,
    oid.T_uuid:         TypeUUID,
    oid.T_inet:         TypeINet,
    oid.T_varchar:      typeVarChar,
}

OidToType maps Postgres object IDs to CockroachDB types.

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) {
                i := MustBeDInt(d)
                if i == math.MinInt64 {
                    return nil, errIntOutOfRange
                }
                return NewDInt(-i), 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).Decimal
                dd := &DDecimal{}
                dd.Decimal.Neg(dec)
                return dd, nil
            },
        },
        UnaryOp{
            Typ:        TypeInterval,
            ReturnType: TypeInterval,
            fn: func(_ *EvalContext, d Datum) (Datum, error) {
                i := d.(*DInterval).Duration
                i.Nanos = -i.Nanos
                i.Days = -i.Days
                i.Months = -i.Months
                return &DInterval{Duration: i}, nil
            },
        },
    },

    UnaryComplement: {
        UnaryOp{
            Typ:        TypeInt,
            ReturnType: TypeInt,
            fn: func(_ *EvalContext, d Datum) (Datum, error) {
                return NewDInt(^MustBeDInt(d)), 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. (variables = sub-expressions, placeholders, indexed vars, etc.)

func ErrString Uses

func ErrString(n NodeFormatter) string

ErrString pretty prints a node to a string. Identifiers are not quoted.

func EscapeSQLString Uses

func EscapeSQLString(in string) string

EscapeSQLString returns an escaped SQL representation of the given string. This is suitable for safely producing a SQL string valid for input to the parser.

func ExprDebugString Uses

func ExprDebugString(expr Expr) string

ExprDebugString generates a multi-line debug string with one node per line in Go format.

func FindEqualComparisonFunction Uses

func FindEqualComparisonFunction(
    leftType, rightType Type,
) (func(*EvalContext, Datum, Datum) (Datum, 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 HasReturningClause Uses

func HasReturningClause(clause ReturningClause) bool

HasReturningClause determines if a ReturningClause is present, given a variant of the ReturningClause interface.

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 LimitDecimalWidth Uses

func LimitDecimalWidth(d *apd.Decimal, precision, scale int) error

LimitDecimalWidth limits d's precision (total number of digits) and scale (number of digits after the decimal point).

func NewInvalidNameErrorf Uses

func NewInvalidNameErrorf(fmt string, args ...interface{}) error

NewInvalidNameErrorf initializes an error carrying the pg code CodeInvalidNameError.

func PGDisplayName Uses

func PGDisplayName(typ Type) string

PGDisplayName returns the Postgres display name for a given type.

func PGIOBuiltinPrefix Uses

func PGIOBuiltinPrefix(typ Type) string

PGIOBuiltinPrefix returns the string prefix to a type's IO functions. This is either the type's postgres display name or the type's postgres display name plus an underscore, depending on the type.

func Serialize Uses

func Serialize(n NodeFormatter) string

Serialize pretty prints a node to a string using FmtParsable; it is appropriate when we store expressions into strings that are later parsed back into expressions.

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 StmtDebugString Uses

func StmtDebugString(stmt Statement) string

StmtDebugString generates multi-line debug strings in Go format for the expressions that are part of the given statement.

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 accumulates the passed datums into the AggregateFunc.
    // Most implementations require one and only one firstArg argument.
    // If an aggregate function requires more than one argument,
    // all additional arguments (after firstArg) are passed in as a
    // variadic collection, otherArgs.
    // This interface (as opposed to `args ...Datum`) avoids unnecessary
    // allocation of otherArgs in the majority of cases.
    Add(_ context.Context, firstArg Datum, otherArgs ...Datum) error

    // Result returns the current value of the accumulation. This value
    // will be a deep copy of any AggregateFunc internal state, so that
    // it will not be mutated by additional calls to Add.
    Result() (Datum, error)

    // Close closes out the AggregateFunc and allows it to release any memory it
    // requested during aggregation, and must be called upon completion of the
    // aggregation.
    Close(context.Context)
}

AggregateFunc accumulates the result of a function of a Datum.

func NewIdentAggregate Uses

func NewIdentAggregate(*EvalContext) 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
    Ordinality bool
    As         AliasClause
}

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 AllColumnsSelector Uses

type AllColumnsSelector struct {
    TableName
}

AllColumnsSelector corresponds to a selection of all columns in a table when used in a SELECT clause. (e.g. `table.*`)

func (*AllColumnsSelector) Eval Uses

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

Eval implements the TypedExpr interface.

func (*AllColumnsSelector) Format Uses

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

Format implements the NodeFormatter interface.

func (*AllColumnsSelector) NormalizeVarName Uses

func (a *AllColumnsSelector) NormalizeVarName() (VarName, error)

NormalizeVarName is a no-op for AllColumnsSelector (already normalized)

func (*AllColumnsSelector) ResolvedType Uses

func (*AllColumnsSelector) ResolvedType() Type

ResolvedType implements the TypedExpr interface.

func (*AllColumnsSelector) String Uses

func (a *AllColumnsSelector) String() string

func (*AllColumnsSelector) TypeCheck Uses

func (expr *AllColumnsSelector) TypeCheck(_ *SemaContext, desired Type) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*AllColumnsSelector) Variable Uses

func (a *AllColumnsSelector) Variable()

Variable implements the VariableExpr interface. Although, the AllColumnsSelector ought to be replaced to an IndexedVar before the points the VariableExpr interface is used.

func (*AllColumnsSelector) Walk Uses

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

Walk implements the Expr interface.

type AllTablesSelector Uses

type AllTablesSelector struct {
    Database                Name
    DBNameOriginallyOmitted bool
}

AllTablesSelector corresponds to a selection of all tables in a database, e.g. when used with GRANT.

func (*AllTablesSelector) Format Uses

func (at *AllTablesSelector) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*AllTablesSelector) NormalizeTablePattern Uses

func (at *AllTablesSelector) NormalizeTablePattern() (TablePattern, error)

NormalizeTablePattern implements the TablePattern interface.

func (*AllTablesSelector) QualifyWithDatabase Uses

func (at *AllTablesSelector) QualifyWithDatabase(database string) error

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

func (*AllTablesSelector) String Uses

func (at *AllTablesSelector) String() string

type AlterTable Uses

type AlterTable struct {
    IfExists bool
    Table    NormalizableTableName
    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
    ValidationBehavior ValidationBehavior
}

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       Name
    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   Name
    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 Name
    // 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() Name

GetColumn implements the ColumnMutationCmd interface.

func (*AlterTableDropNotNull) String Uses

func (n *AlterTableDropNotNull) String() string

type AlterTableSetDefault Uses

type AlterTableSetDefault struct {
    Column  Name
    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() Name

GetColumn implements the ColumnMutationCmd interface.

func (*AlterTableSetDefault) String Uses

func (n *AlterTableSetDefault) String() string

type AlterTableValidateConstraint Uses

type AlterTableValidateConstraint struct {
    Constraint Name
}

AlterTableValidateConstraint represents a VALIDATE CONSTRAINT command.

func (*AlterTableValidateConstraint) Format Uses

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

Format implements the NodeFormatter interface.

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) ResolvedType Uses

func (ta AndExpr) ResolvedType() Type

func (*AndExpr) String Uses

func (node *AndExpr) String() string

func (*AndExpr) TypeCheck Uses

func (expr *AndExpr) TypeCheck(ctx *SemaContext, desired Type) (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 CastTargetType
    // contains filtered or unexported fields
}

AnnotateTypeExpr represents a ANNOTATE_TYPE(expr, type) expression.

func (*AnnotateTypeExpr) Format Uses

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

Format implements the NodeFormatter interface.

func (*AnnotateTypeExpr) String Uses

func (node *AnnotateTypeExpr) String() string

func (*AnnotateTypeExpr) TypeCheck Uses

func (expr *AnnotateTypeExpr) TypeCheck(ctx *SemaContext, desired Type) (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 ArgTypes Uses

type ArgTypes []struct {
    Name string
    Typ  Type
}

ArgTypes is very similar to ArgTypes except it allows keeping a string name for each argument as well and using those when printing the human-readable signature.

func (ArgTypes) Length Uses

func (a ArgTypes) Length() int

Length implements the typeList interface.

func (ArgTypes) String Uses

func (a ArgTypes) String() string

func (ArgTypes) Types Uses

func (a ArgTypes) Types() []Type

Types implements the typeList interface.

type Array Uses

type Array struct {
    Exprs Exprs
    // contains filtered or unexported fields
}

Array represents an array constructor.

func (*Array) Eval Uses

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

Eval implements the TypedExpr interface.

func (*Array) Format Uses

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

Format implements the NodeFormatter interface.

func (Array) ResolvedType Uses

func (ta Array) ResolvedType() Type

func (*Array) String Uses

func (node *Array) String() string

func (*Array) TypeCheck Uses

func (expr *Array) TypeCheck(ctx *SemaContext, desired Type) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*Array) Walk Uses

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

Walk implements the Expr interface.

type ArrayColType Uses

type ArrayColType struct {
    Name string
    // ParamTyp is the type of the elements in this array.
    ParamType   ColumnType
    BoundsExprs Exprs
}

ArrayColType represents an ARRAY column type.

func (*ArrayColType) Format Uses

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

Format implements the NodeFormatter interface.

func (*ArrayColType) String Uses

func (node *ArrayColType) String() string

type ArrayFlatten Uses

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

ArrayFlatten represents a subquery array constructor.

func (*ArrayFlatten) Eval Uses

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

Eval implements the TypedExpr interface.

func (*ArrayFlatten) Format Uses

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

Format implements the NodeFormatter interface.

func (ArrayFlatten) ResolvedType Uses

func (ta ArrayFlatten) ResolvedType() Type

func (*ArrayFlatten) String Uses

func (node *ArrayFlatten) String() string

func (*ArrayFlatten) TypeCheck Uses

func (expr *ArrayFlatten) TypeCheck(ctx *SemaContext, desired Type) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*ArrayFlatten) Walk Uses

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

Walk implements the Expr interface.

type ArraySubscript Uses

type ArraySubscript struct {
    Begin Expr
    End   Expr
    Slice bool
}

ArraySubscript corresponds to the syntax `<name>[ ... ]`.

func (*ArraySubscript) Format Uses

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

Format implements the NodeFormatter interface.

type ArraySubscripts Uses

type ArraySubscripts []*ArraySubscript

ArraySubscripts represents a sequence of one or more array subscripts.

func (ArraySubscripts) Format Uses

func (a ArraySubscripts) 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 Backup Uses

type Backup struct {
    Targets         TargetList
    To              Expr
    IncrementalFrom Exprs
    AsOf            AsOfClause
    Options         KVOptions
}

Backup represents a BACKUP statement.

func (*Backup) CopyNode Uses

func (stmt *Backup) CopyNode() *Backup

CopyNode makes a copy of this Statement without recursing in any child Statements.

func (*Backup) Format Uses

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

Format implements the NodeFormatter interface.

func (*Backup) StatementTag Uses

func (*Backup) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Backup) StatementType Uses

func (*Backup) StatementType() StatementType

StatementType implements the Statement interface.

func (*Backup) String Uses

func (n *Backup) String() string

func (*Backup) WalkStmt Uses

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

WalkStmt is part of the WalkableStmt interface.

type BeginTransaction Uses

type BeginTransaction struct {
    Modes TransactionModes
}

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   Type
    RightType  Type
    ReturnType Type
    // 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) ResolvedType Uses

func (ta BinaryExpr) ResolvedType() Type

func (*BinaryExpr) String Uses

func (node *BinaryExpr) String() string

func (*BinaryExpr) TypeCheck Uses

func (expr *BinaryExpr) TypeCheck(ctx *SemaContext, desired Type) (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
    Pow
    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 returnTyper

    // Info is a description of the function, which is surfaced on the CockroachDB
    // docs site on the "Functions and Operators" page. Descriptions typically use
    // third-person with the function as an implicit subject (e.g. "Calculates
    // infinity"), but should focus more on ease of understanding so other structures
    // might be more appropriate.
    Info string

    AggregateFunc func([]Type, *EvalContext) AggregateFunc
    WindowFunc    func([]Type, *EvalContext) WindowFunc
    // 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).

func (Builtin) Class Uses

func (b Builtin) Class() FunctionClass

Class returns the FunctionClass of this builtin.

func (Builtin) DistSQLBlacklist Uses

func (b Builtin) DistSQLBlacklist() bool

DistSQLBlacklist returns true if the builtin is not supported by DistSQL. See distsqlBlacklist.

func (Builtin) FixedReturnType Uses

func (b Builtin) FixedReturnType() Type

FixedReturnType returns a fixed type that the function returns, returning Any if the return type is based on the function's arguments.

func (Builtin) Fn Uses

func (b Builtin) Fn() func(*EvalContext, Datums) (Datum, error)

Fn returns the Go function which implements the builtin.

func (Builtin) Impure Uses

func (b Builtin) Impure() bool

Impure returns false if this builtin is a pure function of its inputs.

func (Builtin) Signature Uses

func (b Builtin) Signature() string

Signature returns a human-readable signature.

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 CancelJob Uses

type CancelJob struct {
    ID Expr
}

CancelJob represents a CANCEL JOB statement.

func (*CancelJob) Format Uses

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

Format implements the NodeFormatter interface.

func (*CancelJob) StatementTag Uses

func (*CancelJob) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CancelJob) StatementType Uses

func (*CancelJob) StatementType() StatementType

StatementType implements the Statement interface.

func (*CancelJob) String Uses

func (n *CancelJob) String() string

type CancelQuery Uses

type CancelQuery struct {
    ID Expr
}

CancelQuery represents a CANCEL QUERY statement.

func (*CancelQuery) Format Uses

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

Format implements the NodeFormatter interface.

func (*CancelQuery) StatementTag Uses

func (*CancelQuery) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CancelQuery) StatementType Uses

func (*CancelQuery) StatementType() StatementType

StatementType implements the Statement interface.

func (*CancelQuery) String Uses

func (n *CancelQuery) 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) ResolvedType Uses

func (ta CaseExpr) ResolvedType() Type

func (*CaseExpr) String Uses

func (node *CaseExpr) String() string

func (*CaseExpr) TypeCheck Uses

func (expr *CaseExpr) TypeCheck(ctx *SemaContext, desired Type) (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 CastTargetType
    // 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) ResolvedType Uses

func (ta CastExpr) ResolvedType() Type

func (*CastExpr) String Uses

func (node *CastExpr) String() string

func (*CastExpr) TypeCheck Uses

func (expr *CastExpr) TypeCheck(ctx *SemaContext, _ Type) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*CastExpr) Walk Uses

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

Walk implements the Expr interface.

type CastTargetType Uses

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

CastTargetType represents a type that is a valid cast target.

func ParseType Uses

func ParseType(sql string) (CastTargetType, error)

ParseType parses a column type.

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  Type
    RightType Type
    // 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) ResolvedType Uses

func (ta CoalesceExpr) ResolvedType() Type

func (*CoalesceExpr) String Uses

func (node *CoalesceExpr) String() string

func (*CoalesceExpr) TypeCheck Uses

func (expr *CoalesceExpr) TypeCheck(ctx *SemaContext, desired Type) (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 CollateExpr Uses

type CollateExpr struct {
    Expr   Expr
    Locale string
    // contains filtered or unexported fields
}

CollateExpr represents an (expr COLLATE locale) expression.

func (*CollateExpr) Eval Uses

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

Eval implements the TypedExpr interface.

func (*CollateExpr) Format Uses

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

Format implements the NodeFormatter interface.

func (CollateExpr) ResolvedType Uses

func (ta CollateExpr) ResolvedType() Type

func (*CollateExpr) String Uses

func (node *CollateExpr) String() string

func (*CollateExpr) TypeCheck Uses

func (expr *CollateExpr) TypeCheck(ctx *SemaContext, desired Type) (TypedExpr, error)

TypeCheck implements the Expr interface.

func (*CollateExpr) Walk Uses

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

Walk implements the Expr interface.

type CollatedStringColType Uses

type CollatedStringColType struct {
    Name   string
    N      int
    Locale string
}

CollatedStringColType represents a STRING, CHAR or VARCHAR type with a collation locale.

func (*CollatedStringColType) Format Uses

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

Format implements the NodeFormatter interface.

func (*CollatedStringColType) String Uses

func (node *CollatedStringColType) String() string

type CollationEnvironment Uses

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

CollationEnvironment stores the state needed by NewDCollatedString to construct collation keys efficiently.

type ColumnCheckConstraint Uses

type ColumnCheckConstraint struct {
    Expr Expr
}

ColumnCheckConstraint represents either a check on a column.

type ColumnCollation Uses

type ColumnCollation string

ColumnCollation represents a COLLATE clause for 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 NormalizableTableName
    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 ColumnID Uses

type ColumnID uint32

ColumnID is a custom type for ColumnDescriptor IDs.

type ColumnItem Uses

type ColumnItem struct {
    // TableName holds the table prefix, if the name refers to a column.
    TableName TableName
    // ColumnName names the designated column.
    ColumnName Name
    // Selector defines which sub-part of the variable is being
    // accessed.
    Selector NameParts
}

ColumnItem corresponds to the name of a column or sub-item of a column in an expression.

func (*ColumnItem) Column Uses

func (c *ColumnItem) Column() string

Column retrieves the unqualified column name.

func (*ColumnItem) Eval Uses

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

Eval implements the TypedExpr interface.

func (*ColumnItem) Format Uses

func (c *ColumnItem) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*ColumnItem) NormalizeVarName Uses

func (c *ColumnItem) NormalizeVarName() (VarName, error)

NormalizeVarName is a no-op for ColumnItem (already normalized)

func (*ColumnItem) ResolvedType Uses

func (c *ColumnItem) ResolvedType() Type

ResolvedType implements the TypedExpr interface.

func (*ColumnItem) String Uses

func (c *ColumnItem) String() string

func (*ColumnItem) TypeCheck Uses

func (expr *ColumnItem) TypeCheck(_ *SemaContext, desired Type) (TypedExpr, error)

TypeCheck implements the Expr interface. This function has a valid implementation only for testing within this package. During query execution, ColumnItems are replaced to IndexedVars prior to type checking.

func (*ColumnItem) Variable Uses

func (c *ColumnItem) Variable()

Variable implements the VariableExpr interface. Although, the ColumnItem ought to be replaced to an IndexedVar before the points the VariableExpr interface is used.

func (*ColumnItem) Walk Uses

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

Walk implements the Expr interface.

type ColumnMutationCmd Uses

type ColumnMutationCmd interface {
    AlterTableCmd
    GetColumn() Name
}

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
    }
    CheckExprs []ColumnTableDefCheckExpr
    References struct {
        Table          NormalizableTableName
        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.

func (*ColumnTableDef) HasColumnFamily Uses

func (node *ColumnTableDef) HasColumnFamily() bool

HasColumnFamily returns if the ColumnTableDef has a column family.

func (*ColumnTableDef) HasDefaultExpr Uses

func (node *ColumnTableDef) HasDefaultExpr() bool

HasDefaultExpr returns if the ColumnTableDef has a default expression.

func (*ColumnTableDef) HasFKConstraint Uses

func (node *ColumnTableDef) HasFKConstraint() bool

HasFKConstraint returns if the ColumnTableDef has a foreign key constraint.

type ColumnTableDefCheckExpr Uses

type ColumnTableDefCheckExpr struct {
    Expr           Expr
    ConstraintName Name
}

ColumnTableDefCheckExpr represents a check constraint on a column definition within a CREATE TABLE statement.

type ColumnType Uses

type ColumnType interface {
    CastTargetType
    // contains filtered or unexported methods
}

ColumnType represents a type in a column definition.

func DatumTypeToColumnType Uses

func DatumTypeToColumnType(t Type) (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
    SubOperator ComparisonOperator // used for array operators (when Operator is Any, Some, or All)
    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) ResolvedType Uses

func (ta ComparisonExpr) ResolvedType() Type

func (*ComparisonExpr) String Uses

func (node *ComparisonExpr) String() string

func (*ComparisonExpr) TypeCheck Uses

func (expr *ComparisonExpr) TypeCheck(ctx *SemaContext, desired Type) (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

    // The following operators will always be used with an associated SubOperator.
    // If Go had algebraic data types they would be defined in a self-contained
    // manner like:
    //
    // Any(ComparisonOperator)
    // Some(ComparisonOperator)
    // ...
    //
    // where the internal ComparisonOperator qualifies the behavior of the primary
    // operator. Instead, a secondary ComparisonOperator is optionally included in
    // ComparisonExpr for the cases where these operators are the primary op.
    //
    // ComparisonOperator.hasSubOperator returns true for ops in this group.
    Any
    Some
    All
)

ComparisonExpr.Operator

func (ComparisonOperator) String Uses

func (i ComparisonOperator) String() string

type CompositeDatum Uses

type CompositeDatum interface {
    Datum
    // IsComposite returns true if this datum is not round-tripable in a key
    // encoding.
    IsComposite() bool
}

CompositeDatum is a Datum that may require composite encoding in indexes. Any Datum implementing this interface must also add itself to sqlbase/HasCompositeKeyEncoding.

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() []Type
    // DesirableTypes returns the ordered set of types that the constant would
    // prefer to be resolved into. As in AvailableTypes, the order of the returned
    // type slice provides a notion of precedence, with the first element in the
    // ordering being the Constant's "natural type." The function is meant to be
    // differentiated from AvailableTypes in that it will exclude certain types
    // that are possible, but not desirable.
    //
    // An example of this is a floating point numeric constant without a value
    // past the decimal point. It is possible to resolve this constant as a
    // decimal, but it is not desirable.
    DesirableTypes() []Type
    // 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, Type) (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 ContainsWindowVisitor Uses

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

ContainsWindowVisitor checks if walked expressions contain window functions.

func (*ContainsWindowVisitor) ContainsWindowFunc Uses

func (v *ContainsWindowVisitor) ContainsWindowFunc(expr Expr) bool

ContainsWindowFunc determines if an Expr contains a window function.

func (*ContainsWindowVisitor) VisitPost Uses

func (*ContainsWindowVisitor) VisitPost(expr Expr) Expr

VisitPost satisfies the Visitor interface.

func (*ContainsWindowVisitor) VisitPre Uses

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

VisitPre satisfies the Visitor interface.

type CopyFrom Uses

type CopyFrom struct {
    Table   NormalizableTableName
    Columns UnresolvedNames
    Stdin   bool
}

CopyFrom represents a COPY FROM statement.

func (*CopyFrom) Format Uses

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

Format implements the NodeFormatter interface.

func (*CopyFrom) StatementTag Uses

func (*CopyFrom) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CopyFrom) StatementType Uses

func (*CopyFrom) StatementType() StatementType

StatementType implements the Statement interface.

func (*CopyFrom) String Uses

func (n *CopyFrom) String() string

type CreateDatabase Uses

type CreateDatabase struct {
    IfNotExists bool
    Name        Name
    Template    string
    Encoding    string
    Collate     string
    CType       string
}

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       NormalizableTableName
    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         NormalizableTableName
    Interleave    *InterleaveDef
    Defs          TableDefs
    AsSource      *Select
    AsColumnNames NameList // Only to be used in conjunction with AsSource
}

CreateTable represents a CREATE TABLE statement.

func (*CreateTable) As Uses

func (node *CreateTable) As() bool

As returns true if this table represents a CREATE TABLE ... AS statement, false otherwise.

func (*CreateTable) Format Uses

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

Format implements the NodeFormatter interface.

func (*CreateTable) StatementTag Uses

func (n *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 CreateUser Uses

type CreateUser struct {
    Name     Name
    Password *string // pointer so that empty and nil can be differentiated
}

CreateUser represents a CREATE USER statement.

func (*CreateUser) Format Uses

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

Format implements the NodeFormatter interface.

func (*CreateUser) HasPassword Uses

func (node *CreateUser) HasPassword() bool

HasPassword returns if the CreateUser has a password.

func (*CreateUser) StatementTag Uses

func (*CreateUser) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CreateUser) StatementType Uses

func (*CreateUser) StatementType() StatementType

StatementType implements the Statement interface.

func (*CreateUser) String Uses

func (n *CreateUser) String() string

type CreateView Uses

type CreateView struct {
    Name        NormalizableTableName
    ColumnNames NameList
    AsSource    *Select
}

CreateView represents a CREATE VIEW statement.

func (*CreateView) Format Uses

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

Format implements the NodeFormatter interface.

func (*CreateView) StatementTag Uses

func (*CreateView) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*CreateView) StatementType Uses

func (*CreateView) StatementType() StatementType

StatementType implements the Statement interface.

func (*CreateView) String Uses

func (n *CreateView) String() string

type DArray Uses

type DArray struct {
    ParamTyp Type
    Array    Datums
    // HasNulls is set to true if any of the datums within the array are null.
    // This is used in the binary array serialization format.
    HasNulls bool
}

DArray is the array Datum. Any Datum inserted into a DArray are treated as text during serialization.

func AsDArray Uses

func AsDArray(e Expr) (*DArray, bool)

AsDArray attempts to retrieve a *DArray from an Expr, returning a *DArray and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DArray wrapped by a *DOidWrapper is possible.

func MustBeDArray Uses

func MustBeDArray(e Expr) *DArray

MustBeDArray attempts to retrieve a *DArray from an Expr, panicking if the assertion fails.

func NewDArray Uses

func NewDArray(paramTyp Type) *DArray

NewDArray returns a DArray containing elements of the specified type.

func (*DArray) AmbiguousFormat Uses

func (*DArray) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DArray) Append Uses

func (d *DArray) Append(v Datum) error

Append appends a Datum to the array, whose parameterized type must be consistent with the type of the Datum.

func (*DArray) Compare Uses

func (d *DArray) Compare(ctx *EvalContext, other Datum) int

Compare implements the Datum interface.

func (*DArray) Eval Uses

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

Eval implements the TypedExpr interface.

func (*DArray) Format Uses

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

Format implements the NodeFormatter interface.

func (*DArray) IsMax Uses

func (d *DArray) IsMax() bool

IsMax implements the Datum interface.

func (*DArray) IsMin Uses

func (d *DArray) IsMin() bool

IsMin implements the Datum interface.

func (*DArray) Len Uses

func (d *DArray) Len() int

Len returns the length of the Datum array.

func (*DArray) Next Uses

func (d *DArray) Next() (Datum, bool)

Next implements the Datum interface.

func (*DArray) Prev Uses

func (d *DArray) Prev() (Datum, bool)

Prev implements the Datum interface.

func (*DArray) ResolvedType Uses

func (d *DArray) ResolvedType() Type

ResolvedType implements the TypedExpr interface.

func (*DArray) Size Uses

func (d *DArray) Size() uintptr

Size implements the Datum interface.

func (*DArray) String Uses

func (node *DArray) String() string

func (*DArray) TypeCheck Uses

func (d *DArray) TypeCheck(_ *SemaContext, _ Type) (TypedExpr, error)

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

func (*DArray) Validate Uses

func (d *DArray) Validate() error

Validate checks that the given array is valid, for example, that it's not too big.

func (*DArray) Walk Uses

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

Walk implements the Expr interface.

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) AmbiguousFormat Uses

func (*DBool) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DBool) Compare Uses

func (d *DBool) Compare(ctx *EvalContext, 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) 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, bool)

Next implements the Datum interface.

func (*DBool) Prev Uses

func (*DBool) Prev() (Datum, bool)

Prev implements the Datum interface.

func (*DBool) ResolvedType Uses

func (*DBool) ResolvedType() Type

ResolvedType implements the TypedExpr interface.

func (*DBool) Size Uses

func (d *DBool) Size() uintptr

Size implements the Datum interface.

func (*DBool) String Uses

func (node *DBool) String() string

func (*DBool) TypeCheck Uses

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

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

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 ParseDByte Uses

func ParseDByte(s string) (*DBytes, error)

ParseDByte parses a string representation of hex encoded binary data.

func (*DBytes) AmbiguousFormat Uses

func (*DBytes) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DBytes) Compare Uses

func (d *DBytes) Compare(ctx *EvalContext, 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) 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, bool)

Next implements the Datum interface.

func (*DBytes) Prev Uses

func (d *DBytes) Prev() (Datum, bool)

Prev implements the Datum interface.

func (*DBytes) ResolvedType Uses

func (*DBytes) ResolvedType() Type

ResolvedType implements the TypedExpr interface.

func (*DBytes) Size Uses

func (d *DBytes) Size() uintptr

Size implements the Datum interface.

func (*DBytes) String Uses

func (node *DBytes) String() string

func (*DBytes) TypeCheck Uses

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

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

func (*DBytes) Walk Uses

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

Walk implements the Expr interface.

type DCollatedString Uses

type DCollatedString struct {
    Contents string
    Locale   string
    // Key is the collation key.
    Key []byte
}

DCollatedString is the Datum for strings with a locale. The struct members are intended to be immutable.

func NewDCollatedString Uses

func NewDCollatedString(
    contents string, locale string, env *CollationEnvironment,
) *DCollatedString

NewDCollatedString is a helper routine to create a *DCollatedString. Panics if locale is invalid. Not safe for concurrent use.

func (*DCollatedString) AmbiguousFormat Uses

func (*DCollatedString) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DCollatedString) Compare Uses

func (d *DCollatedString) Compare(ctx *EvalContext, other Datum) int

Compare implements the Datum interface.

func (*DCollatedString) Eval Uses

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

Eval implements the TypedExpr interface.

func (*DCollatedString) Format Uses

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

Format implements the NodeFormatter interface.

func (*DCollatedString) IsComposite Uses

func (d *DCollatedString) IsComposite() bool

IsComposite implements the CompositeDatum interface.

func (*DCollatedString) IsMax Uses

func (*DCollatedString) IsMax() bool

IsMax implements the Datum interface.

func (*DCollatedString) IsMin Uses

func (d *DCollatedString) IsMin() bool

IsMin implements the Datum interface.

func (*DCollatedString) Next Uses

func (d *DCollatedString) Next() (Datum, bool)

Next implements the Datum interface.

func (*DCollatedString) Prev Uses

func (d *DCollatedString) Prev() (Datum, bool)

Prev implements the Datum interface.

func (*DCollatedString) ResolvedType Uses

func (d *DCollatedString) ResolvedType() Type

ResolvedType implements the TypedExpr interface.

func (*DCollatedString) Size Uses

func (d *DCollatedString) Size() uintptr

Size implements the Datum interface.

func (*DCollatedString) String Uses

func (node *DCollatedString) String() string

func (*DCollatedString) TypeCheck Uses

func (d *DCollatedString) TypeCheck(_ *SemaContext, _ Type) (TypedExpr, error)

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

func (*DCollatedString) Walk Uses

func (expr *DCollatedString) 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) AmbiguousFormat Uses

func (*DDate) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DDate) Compare Uses

func (d *DDate) Compare(ctx *EvalContext, 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) 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, bool)

Next implements the Datum interface.

func (*DDate) Prev Uses

func (d *DDate) Prev() (Datum, bool)

Prev implements the Datum interface.

func (*DDate) ResolvedType Uses

func (*DDate) ResolvedType() Type

ResolvedType implements the TypedExpr interface.

func (*DDate) Size Uses

func (d *DDate) Size() uintptr

Size implements the Datum interface.

func (*DDate) String Uses

func (node *DDate) String() string

func (*DDate) TypeCheck Uses

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

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

func (*DDate) Walk Uses

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

Walk implements the Expr interface.

type DDecimal Uses

type DDecimal struct {
    apd.Decimal
}

DDecimal is the decimal Datum.

var DecimalOne DDecimal

DecimalOne represents the constant 1 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 TimestampToDecimal Uses

func TimestampToDecimal(ts hlc.Timestamp) *DDecimal

TimestampToDecimal converts the logical timestamp into a decimal value with the number of nanoseconds in the integer part and the logical counter in the decimal part.

func (*DDecimal) AmbiguousFormat Uses

func (*DDecimal) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DDecimal) Compare Uses

func (d *DDecimal) Compare(ctx *EvalContext, 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) IsComposite Uses

func (d *DDecimal) IsComposite() bool

IsComposite implements the CompositeDatum 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, bool)

Next implements the Datum interface.

func (*DDecimal) Prev Uses

func (d *DDecimal) Prev() (Datum, bool)

Prev implements the Datum interface.

func (*DDecimal) ResolvedType Uses

func (*DDecimal) ResolvedType() Type

ResolvedType implements the TypedExpr interface.

func (*DDecimal) SetString Uses

func (d *DDecimal) SetString(s string) error

SetString sets d to s. Any non-standard NaN values are converted to a normal NaN.

func (*DDecimal) Size Uses

func (d *DDecimal) Size() uintptr

Size implements the Datum interface.

func (*DDecimal) String Uses

func (node *DDecimal) String() string

func (*DDecimal) TypeCheck Uses

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

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

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) AmbiguousFormat Uses

func (*DFloat) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DFloat) Compare Uses

func (d *DFloat) Compare(ctx *EvalContext, 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) IsComposite Uses

func (d *DFloat) IsComposite() bool

IsComposite implements the CompositeDatum 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, bool)

Next implements the Datum interface.

func (*DFloat) Prev Uses

func (d *DFloat) Prev() (Datum, bool)

Prev implements the Datum interface.

func (*DFloat) ResolvedType Uses

func (*DFloat) ResolvedType() Type

ResolvedType implements the TypedExpr interface.

func (*DFloat) Size Uses

func (d *DFloat) Size() uintptr

Size implements the Datum interface.

func (*DFloat) String Uses

func (node *DFloat) String() string

func (*DFloat) TypeCheck Uses

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

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

func (*DFloat) Walk Uses

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

Walk implements the Expr interface.

type DIPAddr Uses

type DIPAddr struct {
    ipaddr.IPAddr
}

DIPAddr is the IPAddr Datum.

func NewDIPAddr Uses

func NewDIPAddr(d DIPAddr) *DIPAddr

NewDIPAddr is a helper routine to create a *DIPAddr initialized from its argument.

func ParseDIPAddrFromINetString Uses

func ParseDIPAddrFromINetString(s string) (*DIPAddr, error)

ParseDIPAddrFromINetString parses and returns the *DIPAddr Datum value represented by the provided input INet string, or an error.

func (*DIPAddr) AmbiguousFormat Uses

func (*DIPAddr) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DIPAddr) Compare Uses

func (d *DIPAddr) Compare(ctx *EvalContext, other Datum) int

Compare implements the Datum interface.

func (*DIPAddr) Eval Uses

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

Eval implements the TypedExpr interface.

func (*DIPAddr) Format Uses

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

Format implements the NodeFormatter interface.

func (*DIPAddr) IsMax Uses

func (d *DIPAddr) IsMax() bool

IsMax implements the Datum interface.

func (*DIPAddr) IsMin Uses

func (d *DIPAddr) IsMin() bool

IsMin implements the Datum interface.

func (*DIPAddr) Next Uses

func (d *DIPAddr) Next() (Datum, bool)

Next implements the Datum interface.

func (*DIPAddr) Prev Uses

func (d *DIPAddr) Prev() (Datum, bool)

Prev implements the Datum interface.

func (*DIPAddr) ResolvedType Uses

func (*DIPAddr) ResolvedType() Type

ResolvedType implements the TypedExpr interface.

func (*DIPAddr) Size Uses

func (d *DIPAddr) Size() uintptr

Size implements the Datum interface.

func (*DIPAddr) String Uses

func (node *DIPAddr) String() string

func (*DIPAddr) TypeCheck Uses

func (d *DIPAddr) TypeCheck(_ *SemaContext, _ Type) (TypedExpr, error)

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

func (*DIPAddr) Walk Uses

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

Walk implements the Expr interface.

type DInt Uses

type DInt int64

DInt is the int Datum.

func AsDInt Uses

func AsDInt(e Expr) (DInt, bool)

AsDInt attempts to retrieve a DInt from an Expr, returning a DInt and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DInt wrapped by a *DOidWrapper is possible.

func GenerateUniqueInt Uses

func GenerateUniqueInt(nodeID roachpb.NodeID) DInt

GenerateUniqueInt creates a unique int composed of the current time at a 10-microsecond granularity and the node-id. The node-id is stored in the lower 15 bits of the returned value and the timestamp is stored in the upper 48 bits. The top-bit is left empty so that negative values are not returned. The 48-bit timestamp field provides for 89 years of timestamps. We use a custom epoch (Jan 1, 2015) in order to utilize the entire timestamp range.

Note that GenerateUniqueInt() imposes a limit on node IDs while generateUniqueBytes() does not.

TODO(pmattis): Do we have to worry about persisting the milliseconds value periodically to avoid the clock ever going backwards (e.g. due to NTP adjustment)?

func MustBeDInt Uses

func MustBeDInt(e Expr) DInt

MustBeDInt attempts to retrieve a DInt from an Expr, panicking if the assertion fails.

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) AmbiguousFormat Uses

func (*DInt) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DInt) Compare Uses

func (d *DInt) Compare(ctx *EvalContext, 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) 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, bool)

Next implements the Datum interface.

func (*DInt) Prev Uses

func (d *DInt) Prev() (Datum, bool)

Prev implements the Datum interface.

func (*DInt) ResolvedType Uses

func (*DInt) ResolvedType() Type

ResolvedType implements the TypedExpr interface.

func (*DInt) Size Uses

func (d *DInt) Size() uintptr

Size implements the Datum interface.

func (*DInt) String Uses

func (node *DInt) String() string

func (*DInt) TypeCheck Uses

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

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

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 ParseDIntervalWithField Uses

func ParseDIntervalWithField(s string, field durationField) (*DInterval, error)

ParseDIntervalWithField is like ParseDInterval, but it also takes a DurationField that both specifies the units for unitless, numeric intervals and also specifies the precision of the interval. Any precision in the input interval that's higher than the DurationField value will be truncated downward.

func (*DInterval) AmbiguousFormat Uses

func (*DInterval) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DInterval) Compare Uses

func (d *DInterval) Compare(ctx *EvalContext, 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) 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, bool)

Next implements the Datum interface.

func (*DInterval) Prev Uses

func (d *DInterval) Prev() (Datum, bool)

Prev implements the Datum interface.

func (*DInterval) ResolvedType Uses

func (*DInterval) ResolvedType() Type

ResolvedType implements the TypedExpr interface.

func (*DInterval) Size Uses

func (d *DInterval) Size() uintptr

Size implements the Datum interface.

func (*DInterval) String Uses

func (node *DInterval) String() string

func (*DInterval) TypeCheck Uses

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

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

func (*DInterval) ValueAsString Uses

func (d *DInterval) ValueAsString() string

ValueAsString returns the interval as a string (e.g. "1h2m").

func (*DInterval) Walk Uses

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

Walk implements the Expr interface.

type DOid Uses

type DOid struct {
    // A DOid embeds a DInt, the underlying integer OID for this OID datum.
    DInt
    // contains filtered or unexported fields
}

DOid is the Postgres OID datum. It can represent either an OID type or any of the reg* types, such as regproc or regclass.

func MakeDOid Uses

func MakeDOid(d DInt) DOid

MakeDOid is a helper routine to create a DOid initialized from a DInt.

func NewDOid Uses

func NewDOid(d DInt) *DOid

NewDOid is a helper routine to create a *DOid initialized from a DInt.

func (*DOid) AmbiguousFormat Uses

func (*DOid) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DOid) AsRegProc Uses

func (d *DOid) AsRegProc(name string) *DOid

AsRegProc changes the input DOid into a regproc with the given name and returns it.

func (*DOid) Compare Uses

func (d *DOid) Compare(ctx *EvalContext, other Datum) int

Compare implements the Datum interface.

func (*DOid) Eval Uses

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

Eval implements the TypedExpr interface.

func (*DOid) Format Uses

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

Format implements the Datum interface.

func (*DOid) IsMax Uses

func (d *DOid) IsMax() bool

IsMax implements the Datum interface.

func (*DOid) IsMin Uses

func (d *DOid) IsMin() bool

IsMin implements the Datum interface.

func (*DOid) Next Uses

func (d *DOid) Next() (Datum, bool)

Next implements the Datum interface.

func (*DOid) Prev Uses

func (d *DOid) Prev() (Datum, bool)

Prev implements the Datum interface.

func (*DOid) ResolvedType Uses

func (d *DOid) ResolvedType() Type

ResolvedType implements the Datum interface.

func (*DOid) Size Uses

func (d *DOid) Size() uintptr

Size implements the Datum interface.

func (*DOid) String Uses

func (node *DOid) String() string

func (*DOid) TypeCheck Uses

func (d *DOid) TypeCheck(_ *SemaContext, _ Type) (TypedExpr, error)

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

func (*DOid) Walk Uses

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

Walk implements the Expr interface.

type DOidWrapper Uses

type DOidWrapper struct {
    Wrapped Datum
    Oid     oid.Oid
}

DOidWrapper is a Datum implementation which is a wrapper around a Datum, allowing custom Oid values to be attached to the Datum and its Type (see tOidWrapper). The reason the Datum type was introduced was to permit the introduction of Datum types with new Object IDs while maintaining identical behavior to current Datum types. Specifically, it obviates the need to: - define a new parser.Datum type. - define a new parser.Type type. - support operations and functions for the new Type. - support mixed-type operations between the new Type and the old Type.

Instead, DOidWrapper allows a standard Datum to be wrapped with a new Oid. This approach provides two major advantages: - performance of the existing Datum types are not affected because they

do not need to have custom oid.Oids added to their structure.

- the introduction of new Datum aliases is straightforward and does not require

additions to typing rules or type-dependent evaluation behavior.

Types that currently benefit from DOidWrapper are: - DName => DOidWrapper(*DString, oid.T_name)

func (*DOidWrapper) AmbiguousFormat Uses

func (d *DOidWrapper) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DOidWrapper) Compare Uses

func (d *DOidWrapper) Compare(ctx *EvalContext, other Datum) int

Compare implements the Datum interface.

func (*DOidWrapper) Eval Uses

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

Eval implements the TypedExpr interface.

func (*DOidWrapper) Format Uses

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

Format implements the NodeFormatter interface.

func (*DOidWrapper) IsMax Uses

func (d *DOidWrapper) IsMax() bool

IsMax implements the Datum interface.

func (*DOidWrapper) IsMin Uses

func (d *DOidWrapper) IsMin() bool

IsMin implements the Datum interface.

func (*DOidWrapper) Next Uses

func (d *DOidWrapper) Next() (Datum, bool)

Next implements the Datum interface.

func (*DOidWrapper) Prev Uses

func (d *DOidWrapper) Prev() (Datum, bool)

Prev implements the Datum interface.

func (*DOidWrapper) ResolvedType Uses

func (d *DOidWrapper) ResolvedType() Type

ResolvedType implements the TypedExpr interface.

func (*DOidWrapper) Size Uses

func (d *DOidWrapper) Size() uintptr

Size implements the Datum interface.

func (*DOidWrapper) String Uses

func (node *DOidWrapper) String() string

func (*DOidWrapper) TypeCheck Uses

func (d *DOidWrapper) TypeCheck(_ *SemaContext, _ Type) (TypedExpr, error)

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

func (*DOidWrapper) Walk Uses

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

Walk implements the Expr interface.

type DString Uses

type DString string

DString is the string Datum.

func AsDString Uses

func AsDString(e Expr) (DString, bool)

AsDString attempts to retrieve a DString from an Expr, returning a DString and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DString wrapped by a *DOidWrapper is possible.

func MustBeDString Uses

func MustBeDString(e Expr) DString

MustBeDString attempts to retrieve a DString from an Expr, panicking if the assertion fails.

func NewDString Uses

func NewDString(d string) *DString

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

func (*DString) AmbiguousFormat Uses

func (*DString) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DString) Compare Uses

func (d *DString) Compare(ctx *EvalContext, 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) 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, bool)

Next implements the Datum interface.

func (*DString) Prev Uses

func (d *DString) Prev() (Datum, bool)

Prev implements the Datum interface.

func (*DString) ResolvedType Uses

func (*DString) ResolvedType() Type

ResolvedType implements the TypedExpr interface.

func (*DString) Size Uses

func (d *DString) Size() uintptr

Size implements the Datum interface.

func (*DString) String Uses

func (node *DString) String() string

func (*DString) TypeCheck Uses

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

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

func (*DString) Walk Uses

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

Walk implements the Expr interface.

type DTable Uses

type DTable struct {
    ValueGenerator
}

DTable is the table Datum. It is used for datums that hold an entire table generator. See the comments in generator_builtins.go for details.

func EmptyDTable Uses

func EmptyDTable() *DTable

EmptyDTable returns a new, empty DTable.

func (*DTable) AmbiguousFormat Uses

func (*DTable) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DTable) Compare Uses

func (t *DTable) Compare(ctx *EvalContext, other Datum) int

Compare implements the Datum interface.

func (*DTable) Eval Uses

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

Eval implements the TypedExpr interface.

func (*DTable) Format Uses

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

Format implements the NodeFormatter interface.

func (*DTable) IsMax Uses

func (*DTable) IsMax() bool

IsMax implements the Datum interface.

func (*DTable) IsMin Uses

func (*DTable) IsMin() bool

IsMin implements the Datum interface.

func (*DTable) Next Uses

func (*DTable) Next() (Datum, bool)

Next implements the Datum interface.

func (*DTable) Prev Uses

func (*DTable) Prev() (Datum, bool)

Prev implements the Datum interface.

func (*DTable) ResolvedType Uses

func (t *DTable) ResolvedType() Type

ResolvedType implements the TypedExpr interface.

func (*DTable) Size Uses

func (*DTable) Size() uintptr

Size implements the Datum interface.

func (*DTable) String Uses

func (node *DTable) String() string

func (*DTable) TypeCheck Uses

func (d *DTable) TypeCheck(_ *SemaContext, _ Type) (TypedExpr, error)

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

func (*DTable) Walk Uses

func (expr *DTable) 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, precision time.Duration) (*DTimestamp, error)

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

func (*DTimestamp) AmbiguousFormat Uses

func (*DTimestamp) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DTimestamp) Compare Uses

func (d *DTimestamp) Compare(ctx *EvalContext, 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) 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, bool)

Next implements the Datum interface.

func (*DTimestamp) Prev Uses

func (d *DTimestamp) Prev() (Datum, bool)

Prev implements the Datum interface.

func (*DTimestamp) ResolvedType Uses

func (*DTimestamp) ResolvedType() Type

ResolvedType implements the TypedExpr interface.

func (*DTimestamp) Size Uses

func (d *DTimestamp) Size() uintptr

Size implements the Datum interface.

func (*DTimestamp) String Uses

func (node *DTimestamp) String() string

func (*DTimestamp) TypeCheck Uses

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

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

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 MakeDTimestampTZFromDate Uses

func MakeDTimestampTZFromDate(loc *time.Location, d *DDate) *DTimestampTZ

MakeDTimestampTZFromDate creates a DTimestampTZ from a DDate.

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) AmbiguousFormat Uses

func (*DTimestampTZ) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DTimestampTZ) Compare Uses

func (d *DTimestampTZ) Compare(ctx *EvalContext, 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) 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, bool)

Next implements the Datum interface.

func (*DTimestampTZ) Prev Uses

func (d *DTimestampTZ) Prev() (Datum, bool)

Prev implements the Datum interface.

func (*DTimestampTZ) ResolvedType Uses

func (*DTimestampTZ) ResolvedType() Type

ResolvedType implements the TypedExpr interface.

func (*DTimestampTZ) Size Uses

func (d *DTimestampTZ) Size() uintptr

Size implements the Datum interface.

func (*DTimestampTZ) String Uses

func (node *DTimestampTZ) String() string

func (*DTimestampTZ) TypeCheck Uses

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

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

func (*DTimestampTZ) Walk Uses

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

Walk implements the Expr interface.

type DTuple Uses

type DTuple struct {
    D   Datums

    Sorted bool
}

DTuple is the tuple Datum.

func AsDTuple Uses

func AsDTuple(e Expr) (*DTuple, bool)

AsDTuple attempts to retrieve a *DTuple from an Expr, returning a *DTuple and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DTuple wrapped by a *DOidWrapper is possible.

func NewDTuple Uses

func NewDTuple(d ...Datum) *DTuple

NewDTuple creates a *DTuple with the provided datums. When creating a new DTuple with Datums that are known to be sorted in ascending order, chain this call with DTuple.SetSorted.

func NewDTupleWithCap Uses

func NewDTupleWithCap(c int) *DTuple

NewDTupleWithCap creates a *DTuple with the provided capacity.

func NewDTupleWithLen Uses

func NewDTupleWithLen(l int) *DTuple

NewDTupleWithLen creates a *DTuple with the provided length.

func (*DTuple) AmbiguousFormat Uses

func (*DTuple) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DTuple) AssertSorted Uses

func (d *DTuple) AssertSorted()

AssertSorted asserts that the DTuple is sorted.

func (*DTuple) Compare Uses

func (d *DTuple) Compare(ctx *EvalContext, 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) IsMax Uses

func (d *DTuple) IsMax() bool

IsMax implements the Datum interface.

func (*DTuple) IsMin Uses

func (d *DTuple) IsMin() bool

IsMin implements the Datum interface.

func (*DTuple) Next Uses

func (d *DTuple) Next() (Datum, bool)

Next implements the Datum interface.

func (*DTuple) Normalize Uses

func (d *DTuple) Normalize(ctx *EvalContext)

Normalize sorts and uniques the datum tuple.

func (*DTuple) Prev Uses

func (d *DTuple) Prev() (Datum, bool)

Prev implements the Datum interface.

func (*DTuple) ResolvedType Uses

func (d *DTuple) ResolvedType() Type

ResolvedType implements the TypedExpr interface.

func (*DTuple) SearchSorted Uses

func (d *DTuple) SearchSorted(ctx *EvalContext, target Datum) (int, bool)

SearchSorted searches the tuple for the target Datum, returning an int with the same contract as sort.Search and a boolean flag signifying whether the datum was found. It assumes that the DTuple is sorted and panics if it is not.

func (*DTuple) SetSorted Uses

func (d *DTuple) SetSorted() *DTuple

SetSorted sets the sorted flag on the DTuple. This should be used when a DTuple is known to be sorted based on the datums added to it.

func (*DTuple) Size Uses

func (d *DTuple) Size() uintptr

Size implements the Datum interface.

func (*DTuple) SortedDifference Uses

func (d *DTuple) SortedDifference(ctx *EvalContext, 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) TypeCheck Uses

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

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

func (*DTuple) Walk Uses

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

Walk implements the Expr interface.

type DUuid Uses

type DUuid struct {
    uuid.UUID
}

DUuid is the UUID Datum.

func NewDUuid Uses

func NewDUuid(d DUuid) *DUuid

NewDUuid is a helper routine to create a *DUuid initialized from its argument.

func ParseDUuidFromBytes Uses

func ParseDUuidFromBytes(b []byte) (*DUuid, error)

ParseDUuidFromBytes parses and returns the *DUuid Datum value represented by the provided input bytes, or an error.

func ParseDUuidFromString Uses

func ParseDUuidFromString(s string) (*DUuid, error)

ParseDUuidFromString parses and returns the *DUuid Datum value represented by the provided input string, or an error.

func (*DUuid) AmbiguousFormat Uses

func (*DUuid) AmbiguousFormat() bool

AmbiguousFormat implements the Datum interface.

func (*DUuid) Compare Uses

func (d *DUuid) Compare(ctx *EvalContext, other Datum) int

Compare implements the Datum interface.

func (*DUuid) Eval Uses

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

Eval implements the TypedExpr interface.

func (*DUuid) Format Uses

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

Format implements the NodeFormatter interface.

func (*DUuid) IsMax Uses

func (d *DUuid) IsMax() bool

IsMax implements the Datum interface.

func (*DUuid) IsMin Uses

func (d *DUuid) IsMin() bool

IsMin implements the Datum interface.

func (*DUuid) Next Uses

func (d *DUuid) Next() (Datum, bool)

Next implements the Datum interface.

func (*DUuid) Prev Uses

func (d *DUuid) Prev() (Datum, bool)

Prev implements the Datum interface.

func (*DUuid) ResolvedType Uses

func (*DUuid) ResolvedType() Type

ResolvedType implements the TypedExpr interface.

func (*DUuid) Size Uses

func (d *DUuid) Size() uintptr

Size implements the Datum interface.

func (*DUuid) String Uses

func (node *DUuid) String() string

func (*DUuid) TypeCheck Uses

func (d *DUuid) TypeCheck(_ *SemaContext, _ Type) (TypedExpr, error)

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

func (*DUuid) Walk Uses

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

Walk implements the Expr interface.

type DatabaseQualifiable Uses

type DatabaseQualifiable interface {
    QualifyWithDatabase(database string) error
}

DatabaseQualifiable identifiers can be qualifed with a database name.

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

    // AmbiguousFormat indicates whether the result of formatting this Datum can
    // be interpreted into more than one type. Used with
    // fmtFlags.disambiguateDatumTypes.
    AmbiguousFormat() 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.
    Compare(ctx *EvalContext, other Datum) int

    // Prev returns the previous datum and true, if one exists, or nil and false.
    // The previous datum satisfies the following definition: if the receiver is
    // "b" and the returned datum is "a", then for every compatible datum "x", it
    // holds that "x < b" is true if and only if "x <= a" is true.
    //
    // The return value is undefined if IsMin() returns true.
    //
    // TODO(#12022): for DTuple, the contract is actually that "x < b" (SQL order,
    // where NULL < x is unknown for all x) is true only if "x <= a"
    // (.Compare/encoding order, where NULL <= x is true for all x) is true. This
    // is okay for now: the returned datum is used only to construct a span, which
    // uses .Compare/encoding order and is guaranteed to be large enough by this
    // weaker contract. The original filter expression is left in place to catch
    // false positives.
    Prev() (Datum, bool)

    // IsMin returns true if the datum is equal to the minimum value the datum
    // type can hold.
    IsMin() bool

    // Next returns the next datum and true, if one exists, or nil and false
    // otherwise. The next datum satisfies the following definition: if the
    // receiver is "a" and the returned datum is "b", then for every compatible
    // datum "x", it holds that "x > a" is true if and only if "x >= b" is true.
    //
    // The return value is undefined if IsMax() returns true.
    //
    // TODO(#12022): for DTuple, the contract is actually that "x > a" (SQL order,
    // where x > NULL is unknown for all x) is true only if "x >= b"
    // (.Compare/encoding order, where x >= NULL is true for all x) is true. This
    // is okay for now: the returned datum is used only to construct a span, which
    // uses .Compare/encoding order and is guaranteed to be large enough by this
    // weaker contract. The original filter expression is left in place to catch
    // false positives.
    Next() (Datum, bool)

    // IsMax returns true if the datum is equal to the maximum value the datum
    // type can hold.
    IsMax() bool

    // Size returns a lower bound on the total size of the receiver in bytes,
    // including memory that is pointed at (even if shared between Datum
    // instances) but excluding allocation overhead.
    //
    // It holds for every Datum d that d.Size() >= d.ResolvedType().Size().
    Size() uintptr
    // contains filtered or unexported methods
}

Datum represents a SQL value.

func NewDIntVectorFromDArray Uses

func NewDIntVectorFromDArray(d *DArray) Datum

NewDIntVectorFromDArray is a helper routine to create a *DIntVector (implemented as a *DOidWrapper) initialized from an existing *DArray.

func NewDName Uses

func NewDName(d string) Datum

NewDName is a helper routine to create a *DName (implemented as a *DOidWrapper) initialized from a string.

func NewDNameFromDString Uses

func NewDNameFromDString(d *DString) Datum

NewDNameFromDString is a helper routine to create a *DName (implemented as a *DOidWrapper) initialized from an existing *DString.

func ParseStringAs Uses

func ParseStringAs(t Type, s string, location *time.Location) (Datum, error)

ParseStringAs parses s as type t.

func UnwrapDatum Uses

func UnwrapDatum(d Datum) Datum

UnwrapDatum returns the base Datum type for a provided datum, stripping an *DOidWrapper if present. This is useful for cases like type switches, where type aliases should be ignored.

type Datums Uses

type Datums []Datum

Datums is a slice of Datum values.

func (Datums) Format Uses

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

Format implements the NodeFormatter interface.

func (Datums) Len Uses

func (d Datums) Len() int

Len returns the number of Datum values.

func (Datums) Reverse Uses

func (d Datums) Reverse()

Reverse reverses the order of the Datum values.

func (*Datums) String Uses

func (node *Datums) String() string

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(ctx *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) ResolvedType Uses

func (DefaultVal) ResolvedType() Type

ResolvedType implements the TypedExpr interface.

func (DefaultVal) String Uses

func (node DefaultVal) String() string

func (DefaultVal) TypeCheck Uses

func (expr DefaultVal) TypeCheck(_ *SemaContext, desired Type) (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
    Limit     *Limit
    Returning ReturningClause
}

Delete represents a DELETE statement.

func (*Delete) CopyNode Uses

func (stmt *Delete) CopyNode() *Delete

CopyNode makes a copy of this Statement without recursing in any child Statements.

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 Discard Uses

type Discard struct {
    Mode DiscardMode
}

Discard represents a DISCARD statement.

func (*Discard) Format Uses

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

Format implements the NodeFormatter interface.

func (*Discard) StatementTag Uses

func (*Discard) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*Discard) StatementType Uses

func (*Discard) StatementType() StatementType

StatementType implements the Statement interface.

func (*Discard) String Uses

func (node *Discard) String() string

String implements the Statement interface.

type DiscardMode Uses

type DiscardMode int

DiscardMode is an enum of the various discard modes.

const (
    // DiscardModeAll represents a DISCARD ALL statement.
    DiscardModeAll DiscardMode = iota
)

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
    DropBehavior DropBehavior
}

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        TableNameReferences
    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 DropUser Uses

type DropUser struct {
    Names    NameList
    IfExists bool
}

DropUser represents a DROP USER statement

func (*DropUser) Format Uses

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

Format implements the NodeFormatter interface.

func (*DropUser) StatementTag Uses

func (*DropUser) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*DropUser) StatementType Uses

func (*DropUser) StatementType() StatementType

StatementType implements the Statement interface.

func (*DropUser) String Uses

func (n *DropUser) String() string

type DropView Uses

type DropView struct {
    Names        TableNameReferences
    IfExists     bool
    DropBehavior DropBehavior
}

DropView represents a DROP VIEW statement.

func (*DropView) Format Uses

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

Format implements the NodeFormatter interface.

func (*DropView) StatementTag Uses

func (*DropView) StatementTag() string

StatementTag returns a short string identifying the type of statement.

func (*DropView) StatementType Uses

func (*DropView) StatementType() StatementType

StatementType implements the Statement interface.

func (*DropView) String Uses

func (n *DropView) String() string

type EvalContext Uses

type EvalContext struct {
    ClusterID uuid.UUID
    NodeID    roachpb.NodeID

    // Location references the *Location on the current Session.
    Location **time.Location
    // Database is the database in the current Session.
    Database string
    // User is the user in the current Session.
    User string
    // SearchPath is the search path for databases used when encountering an
    // unqualified table name. Names in the search path are normalized already.
    // This must not be modified (this is shared from the session).
    SearchPath SearchPath
    // Ctx represents the context in which the expression is evaluated. This will
    // point to the Session's context container.
    // NOTE: seems a bit lazy to hold a pointer to the session's context here,
    // instead of making sure the right context is explicitly set before the
    // EvalContext is used. But there's already precedent with the Location field,
    // and also at the time of writing, EvalContexts are initialized with the
    // planner and not mutated.
    Ctx contextHolder

    Planner EvalPlanner

    // Ths transaction in which the statement is executing.
    Txn *client.Txn

    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

    Mon *mon.BytesMonitor

    // ActiveMemAcc is the account to which values are allocated during
    // evaluation. It can change over the course of evaluation, such as on a
    // per-row basis.
    ActiveMemAcc *mon.BoundAccount
    // 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.

ATTENTION: Fields from this struct are also represented in distsqlrun.EvalContext. Make sure to keep the two in sync. TODO(andrei): remove or limit the duplication.

func MakeTestingEvalContext Uses

func MakeTestingEvalContext() EvalContext

MakeTestingEvalContext returns an EvalContext that includes a MemoryMonitor.

func NewTestingEvalContext Uses

func NewTestingEvalContext() *EvalContext

NewTestingEvalContext is a convenience version of MakeTestingEvalContext that returns a pointer.

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) GetClusterTimestampRaw Uses

func (ctx *EvalContext) GetClusterTimestampRaw() hlc.Timestamp

GetClusterTimestampRaw exposes the clusterTimestamp field. Also see GetClusterTimestamp().

func (*EvalContext) GetLocation Uses

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

GetLocation returns the session timezone.

func (*EvalContext) GetStmtTimestamp Uses

func (ctx *EvalContext) GetStmtTimestamp() time.Time

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) *DTimestampTZ

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

func (*EvalContext) GetTxnTimestampNoZone Uses

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

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

func (*EvalContext) GetTxnTimestampRaw Uses

func (ctx *EvalContext) GetTxnTimestampRaw() time.Time

GetTxnTimestampRaw exposes the txnTimestamp field. Also see GetTxnTimestamp() and GetTxnTimestampNoZone().

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.

func (*EvalContext) Stop Uses

func (ctx *EvalContext) Stop(c context.Context)

Stop closes out the EvalContext and must be called once it is no longer in use.

type EvalPlanner Uses

type EvalPlanner interface {
    // QueryRow executes a SQL query string where exactly 1 result row is
    // expected and returns that row.
    QueryRow(ctx context.Context, sql string, args ...interface{}) (Datums, error)

    // QualifyWithDatabase resolves a possibly unqualified table name into a
    // normalized table name that is qualified by database.
    QualifyWithDatabase(ctx context.Context, t *NormalizableTableName) (*TableName, error)
}

EvalPlanner is a limited planner that can be used from 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) ResolvedType Uses

func (ta ExistsExpr) ResolvedType() Type

func (*ExistsExpr) String Uses

func (node *ExistsExpr) String() string

func (*ExistsExpr) TypeCheck Uses

func (expr *ExistsExpr) TypeCheck(ctx *SemaContext, desired Type) (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 defines how EXPLAIN should operate (VERBOSE, METADATA,
    // etc.) Which options are valid depends on the explain mode. See
    // sql/explain.go for details.
    Options []string

    // Statement is the statement being EXPLAINed.
    Statement Statement
}

Explain represents an EXPLAIN statement.

func (*Explain) CopyNode Uses

func (stmt *Explain) CopyNode() *Explain

CopyNode makes a copy of this Statement without recursing in any child Statements.

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. It is not valid to call TypeCheck with a nil desired
    // type. Instead, call it with wildcard type TypeAny if no specific type is
    // desired. This restriction is also true of most methods and functions related
    // to type checking.
    TypeCheck(ctx *SemaContext, desired Type) (TypedExpr, error)
}

Expr represents an expression.

func ParseExpr Uses

func ParseExpr(sql string) (Expr, error)

ParseExpr is a short-hand for parseExprs([]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.

NOTE: Do not count on the WalkStmt/WalkExpr machinery to visit all expressions contained in a query. Only a sub-set of all expressions are found by WalkStmt and subsequently traversed. See the comment below on WalkStmt for details.

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 ParseExprs Uses

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

ParseExprs is a short-hand for parseExprs(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 FamilyTableDef Uses

type FamilyTableDef struct {
    Name    Name
    Columns NameList
}

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
    Width         int
    PrecSpecified bool // true if the value of Prec is not the default
}

FloatColType represents a REAL, DOUBLE or FLOAT type.

func NewFloatColType Uses

func NewFloatColType(prec int, precSpecified bool) *FloatColType

NewFloatColType creates a type representing a FLOAT, optionally with a precision.

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 FmtAnonymize FmtFlags = &fmtFlags{anonymize: true}

FmtAnonymize instructs the pretty-printer to remove any name but function names. TODO(knz): temporary until a better solution is found for #13968

var FmtArrays FmtFlags = &fmtFlags{withinArray: true, bareStrings: true}

FmtArrays instructs the pretty-printer to print strings without wrapping quotes, if the string contains no special characters.

var FmtBareIdentifiers FmtFlags = &fmtFlags{bareIdentifiers: true}

FmtBareIdentifiers instructs the pretty-printer to print identifiers without wrapping quotes in any case.

var FmtBareStrings FmtFlags = &fmtFlags{bareStrings: true}

FmtBareStrings instructs the pretty-printer to print strings without wrapping quotes, if the string contains no special characters.

var FmtCheckEquivalence FmtFlags = &fmtFlags{symbolicVars: true, disambiguateDatumTypes: true}

FmtCheckEquivalence instructs the pretty-printer to produce a representation that can be used to check equivalence of expressions. Specifically:

- IndexedVars are formatted using symbolic notation (to disambiguate
  columns).
- datum types are disambiguated with explicit type
  annotations. This is necessary because datums of different types
  can otherwise be formatted to the same string: (for example the
  DDecimal 1 and the DInt 1).
var FmtHideConstants FmtFlags = &fmtFlags{hideConstants: true}

FmtHideConstants instructs the pretty-printer to produce a representation that does not disclose query-specific data.

var FmtParsable FmtFlags = &fmtFlags{disambiguateDatumTypes: true}

FmtParsable instructs the pretty-printer to produce a representation that can be parsed into an equivalent expression (useful for serialization of expressions).

var FmtShowTypes FmtFlags = &fmtFlags{showTypes: true}

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

var FmtSimple FmtFlags = &fmtFlags{}

FmtSimple instructs the pretty-printer to produce a straightforward representation.

var FmtSimpleQualified FmtFlags = &fmtFlags{alwaysQualify: true}

FmtSimpleQualified instructs the pretty-printer to produce a straightforward representation that qualifies table names.

var FmtSimpleWithPasswords FmtFlags = &fmtFlags{showPasswords: true}

FmtSimpleWithPasswords instructs the pretty-printer to produce a straightforward representation that does not suppress passwords.

func FmtExpr Uses

func FmtExpr(base FmtFlags, showTypes bool, symbolicVars bool, showTableAliases bool) FmtFlags

FmtExpr returns FmtFlags that indicate how the pretty-printer should format expressions.

func FmtIndexedVarFormat Uses

func FmtIndexedVarFormat(
    base FmtFlags, fn func(buf *bytes.Buffer, f FmtFlags, c IndexedVarContainer, idx int),
) FmtFlags

FmtIndexedVarFormat returns FmtFlags that customizes the printing of IndexedVars using the provided function.

func FmtReformatTableNames Uses

func FmtReformatTableNames(
    base FmtFlags, fn func(*NormalizableTableName, *bytes.Buffer, FmtFlags),
) FmtFlags

FmtReformatTableNames returns FmtFlags that instructs the pretty-printer to substitute the printing of table names using the provided function.

func FmtStarDatumFormat Uses

func FmtStarDatumFormat(base FmtFlags, fn func(buf *bytes.Buffer, f FmtFlags)) FmtFlags

FmtStarDatumFormat returns FmtFlags that customizes the printing of StarDatums using the provided function.

func StripTypeFormatting Uses

func StripTypeFormatting(f FmtFlags) FmtFlags

StripTypeFormatting removes the flag that extracts types from the format flags, so as to enable rendering expressions for which types have not been computed yet.

type ForeignKeyConstraintTableDef Uses

type ForeignKeyConstraintTableDef struct {
    Name     Name
    Table    NormalizableTableName
    FromCols NameList
    ToCols   NameList
}

ForeignKeyConstraintTableDef represents a FOREIGN KEY constraint in the AST.

func (*ForeignKeyConstraintTableDef) Format Uses

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

Format implements the NodeFormatter interface.

type From Uses

type From struct {
    Tables TableExprs
    AsOf   AsOfClause
}

From represents a FROM clause.

func (*From) Format Uses

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

Format implements the NodeFormatter interface.

type FuncExpr Uses

type FuncExpr struct {
    Func  ResolvableFunctionReference
    Type  funcType
    Exprs Exprs
    // Filter is used for filters on aggregates: SUM(k) FILTER (WHERE k > 0)
    Filter    Expr
    WindowDef *WindowDef
    // 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) GetAggregateConstructor Uses

func (node *FuncExpr) GetAggregateConstructor() func(*EvalContext) AggregateFunc

GetAggregateConstructor exposes the AggregateFunc field for use by the group node in package sql.

func (*FuncExpr) GetWindowConstructor Uses

func (node *FuncExpr) GetWindowConstructor() func(*EvalContext) WindowFunc

GetWindowConstructor returns a window function constructor if the FuncExpr is a built-in window function.

func (*FuncExpr) IsDistSQLBlacklist Uses

func (node *FuncExpr) IsDistSQLBlacklist() bool

IsDistSQLBlacklist returns whether the function is not supported by DistSQL.

func (*FuncExpr) IsImpure Uses

func (node *FuncExpr) IsImpure() bool

IsImpure returns whether the function application is impure, meaning that it potentially returns a different value when called in the same statement with the same parameters.

func (*FuncExpr) IsWindowFunctionApplication Uses

func (node *FuncExpr) IsWindowFunctionApplication() bool

IsWindowFunctionApplication returns if the function is being applied as a window function.

func (FuncExpr) ResolvedType Uses

func (ta FuncExpr) ResolvedType() Type

func (*FuncExpr) String Uses

func (node *FuncExpr) String() string

func (*FuncExpr) TypeCheck Uses

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

TypeCheck implements the Expr interface.

func (*FuncExpr) Walk Uses

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

Walk implements the Expr interface.

type FunctionClass Uses

type FunctionClass int

FunctionClass specifies the class of the builtin function.

const (
    // NormalClass is a standard builtin function.
    NormalClass FunctionClass = iota
    // AggregateClass is a builtin aggregate function.
    AggregateClass
    // WindowClass is a builtin window function.
    WindowClass
    // GeneratorClass is a builtin generator function.
    GeneratorClass
)

type FunctionDefinition Uses

type FunctionDefinition struct {
    // Name is the short name of the function.
    Name string
    // HasOverloadsNeedingRepeatedEvaluation is true if one or more of
    // the overload definitions has needsRepeatedEvaluation set.
    // Set e.g. for aggregate functions.
    HasOverloadsNeedingRepeatedEvaluation bool
    // Definition is the set of overloads for this function name.
    Definition []overloadImpl
}

FunctionDefinition implements a reference to the (possibly several) overloads for a built-in function.

func (*FunctionDefinition) Format Uses

func (fd *FunctionDefinition) Format(buf *bytes.Buffer, f FmtFlags)

Format implements the NodeFormatter interface.

func (*FunctionDefinition) String Uses

func (fd *FunctionDefinition) String() string

type FunctionReference Uses

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

FunctionReference is the common interface to UnresolvedName and QualifiedFunctionName.

type Grant Uses

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

Grant represents a GRANT statement.

func (*Grant)