Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeRawBytesToByteArray(data string, be sessiondata.BytesEncodeFormat) ([]byte, error)
- func DecodeRawBytesToByteArrayAuto(data []byte) ([]byte, error)
- func EncodeByteArrayToRawBytes(data string, be sessiondata.BytesEncodeFormat, skipHexPrefix bool) string
- func EncodeEscapedSQLIdent(buf *bytes.Buffer, s string)
- func EncodeLocaleName(buf *bytes.Buffer, s string)
- func EncodeRestrictedSQLIdent(buf *bytes.Buffer, s string, flags EncodeFlags)
- func EncodeSQLBytes(buf *bytes.Buffer, in string)
- func EncodeSQLString(buf *bytes.Buffer, in string)
- func EncodeSQLStringWithFlags(buf *bytes.Buffer, in string, flags EncodeFlags)
- func EncodeUnrestrictedSQLIdent(buf *bytes.Buffer, s string, flags EncodeFlags)
- func EscapeSQLString(in string) string
- func GetKeywordID(k string) int32
- func IsDigit(ch int) bool
- func IsHexDigit(ch int) bool
- func IsIdentMiddle(ch int) bool
- func IsIdentStart(ch int) bool
- func NormalizeName(n string) string
- type EncodeFlags
Constants ¶
const ABORT = 57363
const ACTION = 57364
const ADD = 57365
const ADMIN = 57366
const AGGREGATE = 57367
const ALL = 57368
const ALTER = 57369
const ANALYSE = 57370
const ANALYZE = 57371
const AND = 57372
const AND_AND = 57373
const ANNOTATE_TYPE = 57375
const ANY = 57374
const ARRAY = 57376
const AS = 57377
const ASC = 57378
const ASYMMETRIC = 57379
const AS_LA = 57797
const AT = 57380
const AUTHORIZATION = 57381
const AUTOMATIC = 57382
const BACKUP = 57383
const BCONST = 57348
const BEGIN = 57384
const BETWEEN = 57385
const BIGINT = 57386
const BIGSERIAL = 57387
const BIT = 57388
const BITCONST = 57349
const BLOB = 57390
const BOOL = 57391
const BOOLEAN = 57392
const BOTH = 57393
const BUCKET_COUNT = 57389
const BUNDLE = 57394
const BY = 57395
const BYTEA = 57396
const BYTES = 57397
const CACHE = 57398
const CANCEL = 57399
const CASCADE = 57400
const CASE = 57401
const CAST = 57402
const CHANGEFEED = 57403
const CHAR = 57404
const CHARACTER = 57405
const CHARACTERISTICS = 57406
const CHECK = 57407
const CLUSTER = 57408
const COALESCE = 57409
const COLLATE = 57410
const COLLATION = 57411
const COLUMN = 57412
const COLUMNS = 57413
const COMMENT = 57414
const COMMIT = 57415
const COMMITTED = 57416
const COMPACT = 57417
const COMPLETE = 57418
const CONCAT = 57419
const CONCURRENTLY = 57420
const CONFIGURATION = 57421
const CONFIGURATIONS = 57422
const CONFIGURE = 57423
const CONFLICT = 57424
const CONSTRAINT = 57425
const CONSTRAINTS = 57426
const CONTAINED_BY = 57798
const CONTAINS = 57427
const CONVERSION = 57428
const COPY = 57429
const COVERING = 57430
const CREATE = 57431
const CREATEROLE = 57432
const CROSS = 57433
const CUBE = 57434
const CURRENT = 57435
const CURRENT_CATALOG = 57436
const CURRENT_DATE = 57437
const CURRENT_ROLE = 57439
const CURRENT_SCHEMA = 57438
const CURRENT_TIME = 57440
const CURRENT_TIMESTAMP = 57441
const CURRENT_USER = 57442
const CYCLE = 57443
const DATA = 57444
const DATABASE = 57445
const DATABASES = 57446
const DATE = 57447
const DAY = 57448
const DEALLOCATE = 57452
const DEC = 57449
const DECIMAL = 57450
const DEFAULT = 57451
const DEFERRABLE = 57453
const DEFERRED = 57454
const DELETE = 57455
const DESC = 57456
const DISCARD = 57457
const DISTINCT = 57458
const DO = 57459
const DOMAIN = 57460
const DOT_DOT = 57355
const DOUBLE = 57461
const DROP = 57462
const ELSE = 57463
const ENCODING = 57464
const END = 57465
const ENUM = 57466
const ERROR = 57362
const ESCAPE = 57467
const EXCEPT = 57468
const EXCLUDE = 57469
const EXECUTE = 57471
const EXISTS = 57470
const EXPERIMENTAL = 57472
const EXPERIMENTAL_AUDIT = 57475
const EXPERIMENTAL_FINGERPRINTS = 57473
const EXPERIMENTAL_RELOCATE = 57739
const EXPERIMENTAL_REPLICA = 57474
const EXPIRATION = 57476
const EXPLAIN = 57477
const EXPORT = 57478
const EXTENSION = 57479
const EXTRACT = 57480
const EXTRACT_DURATION = 57481
const FALSE = 57482
const FAMILY = 57483
const FCONST = 57351
const FETCH = 57484
const FETCHTEXT = 57486
const FETCHTEXT_PATH = 57488
const FETCHVAL = 57485
const FETCHVAL_PATH = 57487
const FILES = 57489
const FILTER = 57490
const FIRST = 57491
const FLOAT = 57492
const FLOAT4 = 57493
const FLOAT8 = 57494
const FLOORDIV = 57495
const FOLLOWING = 57496
const FOR = 57497
const FORCE_INDEX = 57498
const FOREIGN = 57499
const FROM = 57500
const FULL = 57501
const FUNCTION = 57502
const GLOBAL = 57503
const GRANT = 57504
const GRANTS = 57505
const GREATER_EQUALS = 57357
const GREATEST = 57506
const GROUP = 57507
const GROUPING = 57508
const GROUPS = 57509
const HASH = 57511
const HAVING = 57510
const HELPTOKEN = 57801
const HIGH = 57512
const HISTOGRAM = 57513
const HOUR = 57514
const ICONST = 57350
const IDENT = 57346
const IF = 57515
const IFERROR = 57516
const IFNULL = 57517
const IGNORE_FOREIGN_KEYS = 57518
const ILIKE = 57519
const IMMEDIATE = 57520
const IMPORT = 57521
const IN = 57522
const INCLUDE = 57523
const INCREMENT = 57524
const INCREMENTAL = 57525
const INDEX = 57529
const INDEXES = 57530
const INET = 57526
const INET_CONTAINED_BY_OR_EQUALS = 57527
const INET_CONTAINS_OR_EQUALS = 57528
const INITIALLY = 57533
const INJECT = 57531
const INNER = 57534
const INSERT = 57535
const INT = 57536
const INT2 = 57538
const INT2VECTOR = 57537
const INT4 = 57539
const INT64 = 57541
const INT8 = 57540
const INTEGER = 57542
const INTERLEAVE = 57532
const INTERSECT = 57543
const INTERVAL = 57544
const INTO = 57545
const INVERTED = 57546
const IS = 57547
const ISERROR = 57548
const ISNULL = 57549
const ISOLATION = 57550
const JOB = 57551
const JOBS = 57552
const JOIN = 57553
const JSON = 57554
const JSONB = 57555
const JSON_ALL_EXISTS = 57557
const JSON_SOME_EXISTS = 57556
const KEY = 57558
const KEYS = 57559
const KV = 57560
const LANGUAGE = 57561
const LAST = 57562
const LATERAL = 57563
const LC_COLLATE = 57565
const LC_CTYPE = 57564
const LEADING = 57566
const LEASE = 57567
const LEAST = 57568
const LEFT = 57569
const LESS = 57570
const LESS_EQUALS = 57356
const LEVEL = 57571
const LIKE = 57572
const LIMIT = 57573
const LIST = 57574
const LOCAL = 57575
const LOCALTIME = 57576
const LOCALTIMESTAMP = 57577
const LOCKED = 57578
const LOGIN = 57579
const LOOKUP = 57580
const LOW = 57581
const LSHIFT = 57582
const MATCH = 57583
const MATERIALIZED = 57584
const MAXVALUE = 57587
const MERGE = 57585
const MINUTE = 57588
const MINVALUE = 57586
const MONTH = 57589
const NAME = 57591
const NAMES = 57592
const NAN = 57590
const NATURAL = 57593
const NEXT = 57594
const NO = 57595
const NOCREATEROLE = 57596
const NOLOGIN = 57597
const NONE = 57599
const NORMAL = 57600
const NOT = 57601
const NOTHING = 57602
const NOTNULL = 57603
const NOT_EQUALS = 57358
const NOT_LA = 57795
const NOT_REGIMATCH = 57361
const NOT_REGMATCH = 57359
const NOWAIT = 57604
const NO_INDEX_JOIN = 57598
const NULL = 57605
const NULLIF = 57606
const NULLS = 57607
const NUMERIC = 57608
const OF = 57609
const OFF = 57610
const OFFSET = 57611
const OID = 57612
const OIDS = 57613
const OIDVECTOR = 57614
const ON = 57615
const ONLY = 57616
const OPERATOR = 57630
const OPT = 57617
const OPTION = 57618
const OPTIONS = 57619
const OR = 57620
const ORDER = 57621
const ORDINALITY = 57622
const OTHERS = 57623
const OUT = 57624
const OUTER = 57625
const OVER = 57626
const OVERLAPS = 57627
const OVERLAY = 57628
const OWNED = 57629
const PARENT = 57631
const PARTIAL = 57632
const PARTITION = 57633
const PARTITIONS = 57634
const PASSWORD = 57635
const PAUSE = 57636
const PHYSICAL = 57637
const PLACEHOLDER = 57352
const PLACING = 57638
const PLAN = 57639
const PLANS = 57640
const POSITION = 57641
const POSTFIXOP = 57799
const PRECEDING = 57642
const PRECISION = 57643
const PREPARE = 57644
const PRESERVE = 57645
const PRIMARY = 57646
const PRIORITY = 57647
const PROCEDURAL = 57648
const PUBLIC = 57649
const PUBLICATION = 57650
const QUERIES = 57651
const QUERY = 57652
const RANGE = 57653
const RANGES = 57654
const READ = 57655
const REAL = 57656
const RECURSIVE = 57657
const REF = 57658
const REFERENCES = 57659
const REGCLASS = 57660
const REGIMATCH = 57360
const REGNAMESPACE = 57663
const REGPROC = 57661
const REGPROCEDURE = 57662
const REGTYPE = 57664
const REINDEX = 57665
const RELEASE = 57670
const REMOVE_PATH = 57666
const RENAME = 57667
const REPEATABLE = 57668
const REPLACE = 57669
const RESET = 57671
const RESTORE = 57672
const RESTRICT = 57673
const RESUME = 57674
const RETURNING = 57675
const REVOKE = 57676
const RIGHT = 57677
const ROLE = 57678
const ROLES = 57679
const ROLLBACK = 57680
const ROLLUP = 57681
const ROW = 57682
const ROWS = 57683
const RSHIFT = 57684
const RULE = 57685
const SAVEPOINT = 57686
const SCATTER = 57687
const SCHEMA = 57688
const SCHEMAS = 57689
const SCONST = 57347
const SCRUB = 57690
const SEARCH = 57691
const SECOND = 57692
const SELECT = 57693
const SEQUENCE = 57694
const SEQUENCES = 57695
const SERIAL = 57696
const SERIAL2 = 57697
const SERIAL4 = 57698
const SERIAL8 = 57699
const SERIALIZABLE = 57700
const SERVER = 57701
const SESSION = 57702
const SESSIONS = 57703
const SESSION_USER = 57704
const SET = 57705
const SETTING = 57706
const SETTINGS = 57707
const SHARE = 57708
const SHOW = 57709
const SIMILAR = 57710
const SIMPLE = 57711
const SKIP = 57712
const SMALLINT = 57713
const SMALLSERIAL = 57714
const SNAPSHOT = 57715
const SOME = 57716
const SPLIT = 57717
const SQL = 57718
const START = 57719
const STATISTICS = 57720
const STATUS = 57721
const STDIN = 57722
const STORE = 57725
const STORED = 57726
const STORING = 57727
const STRICT = 57723
const STRING = 57724
const SUBSCRIPTION = 57732
const SUBSTRING = 57728
const SYMMETRIC = 57729
const SYNTAX = 57730
const SYSTEM = 57731
const TABLE = 57733
const TABLES = 57734
const TEMP = 57735
const TEMPLATE = 57736
const TEMPORARY = 57737
const TESTING_RELOCATE = 57738
const TEXT = 57740
const THEN = 57741
const THROTTLING = 57748
const TIES = 57742
const TIME = 57743
const TIMESTAMP = 57745
const TIMESTAMPTZ = 57746
const TIMETZ = 57744
const TO = 57747
const TRACE = 57750
const TRACING = 57759
const TRAILING = 57749
const TRANSACTION = 57751
const TREAT = 57752
const TRIGGER = 57753
const TRIM = 57754
const TRUE = 57755
const TRUNCATE = 57756
const TRUSTED = 57757
const TYPE = 57758
const TYPEANNOTATE = 57354
const TYPECAST = 57353
const UMINUS = 57800
const UNBOUNDED = 57760
const UNCOMMITTED = 57761
const UNION = 57762
const UNIQUE = 57763
const UNKNOWN = 57764
const UNLOGGED = 57765
const UNSPLIT = 57766
const UNTIL = 57769
const UPDATE = 57767
const UPSERT = 57768
const USE = 57770
const USER = 57771
const USERS = 57772
const USING = 57773
const UUID = 57774
const VALID = 57775
const VALIDATE = 57776
const VALUE = 57777
const VALUES = 57778
const VARBIT = 57779
const VARCHAR = 57780
const VARIADIC = 57781
const VARYING = 57783
const VIEW = 57782
const VIRTUAL = 57784
const WHEN = 57785
const WHERE = 57786
const WINDOW = 57787
const WITH = 57788
const WITHIN = 57789
const WITHOUT = 57790
const WITH_LA = 57796
const WORK = 57791
const WRITE = 57792
const YEAR = 57793
const ZONE = 57794
Variables ¶
var AllowedExperimental = map[string]struct{}{
"ranges": {},
}
AllowedExperimental contains keywords for which the EXPERIMENTAL_ or TESTING_ prefixes are allowed to be parsed along with the keyword to the same token. This ambiguity exists during the deprecation period of an EXPERIMENTAL_ keyword as it is being transitioned to the normal version. Once the transition is done, the keyword should be removed from here as well.
var KeywordNames = []string{}/* 415 elements not displayed */
KeywordNames contains all keywords sorted, so that pg_get_keywords returns deterministic results.
var KeywordsCategories = map[string]string{}/* 415 elements not displayed */
Functions ¶
func DecodeRawBytesToByteArray ¶
func DecodeRawBytesToByteArray(data string, be sessiondata.BytesEncodeFormat) ([]byte, error)
DecodeRawBytesToByteArray converts raw bytes to a SQL-level byte array according to the encoding specification in "be". When using the Hex format, the caller is responsible for skipping the "\x" prefix, if any. See DecodeRawBytesToByteArrayAuto() below for an alternative.
func DecodeRawBytesToByteArrayAuto ¶
DecodeRawBytesToByteArrayAuto detects which format to use with DecodeRawBytesToByteArray(). It only supports hex ("\x" prefix) and escape.
func EncodeByteArrayToRawBytes ¶
func EncodeByteArrayToRawBytes( data string, be sessiondata.BytesEncodeFormat, skipHexPrefix bool, ) string
EncodeByteArrayToRawBytes converts a SQL-level byte array into raw bytes according to the encoding specification in "be". If the skipHexPrefix argument is set, the hexadecimal encoding does not prefix the output with "\x". This is suitable e.g. for the encode() built-in.
func EncodeEscapedSQLIdent ¶
EncodeEscapedSQLIdent writes the identifier in s to buf. The identifier is always quoted. Double quotes inside the identifier are escaped.
func EncodeLocaleName ¶
EncodeLocaleName writes the locale identifier in s to buf. Any dash characters are mapped to underscore characters. Underscore characters do not need to be quoted, and they are considered equivalent to dash characters by the CLDR standard: http://cldr.unicode.org/.
func EncodeRestrictedSQLIdent ¶
func EncodeRestrictedSQLIdent(buf *bytes.Buffer, s string, flags EncodeFlags)
EncodeRestrictedSQLIdent writes the identifier in s to buf. The identifier is quoted if either the flags ask for it, the identifier contains special characters, or the identifier is a reserved SQL keyword.
func EncodeSQLBytes ¶
EncodeSQLBytes encodes the SQL byte array in 'in' to buf, to a format suitable for re-scanning. We don't use a straightforward hex encoding here with x'...' because the result would be less compact. We are trading a little more time during the encoding to have a little less bytes on the wire.
func EncodeSQLString ¶
EncodeSQLString writes a string literal to buf. All unicode and non-printable characters are escaped.
func EncodeSQLStringWithFlags ¶
func EncodeSQLStringWithFlags(buf *bytes.Buffer, in string, flags EncodeFlags)
EncodeSQLStringWithFlags writes a string literal to buf. All unicode and non-printable characters are escaped. flags controls the output format: if encodeBareString is set, the output string will not be wrapped in quotes if the strings contains no special characters.
func EncodeUnrestrictedSQLIdent ¶
func EncodeUnrestrictedSQLIdent(buf *bytes.Buffer, s string, flags EncodeFlags)
EncodeUnrestrictedSQLIdent writes the identifier in s to buf. The identifier is only quoted if the flags don't tell otherwise and the identifier contains special characters.
func EscapeSQLString ¶
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 GetKeywordID ¶
GetKeywordID returns the lex id of the SQL keyword k or IDENT if k is not a keyword.
func IsHexDigit ¶
IsHexDigit returns true if the character is a valid hexadecimal digit.
func IsIdentMiddle ¶
IsIdentMiddle returns true if the character is valid inside an identifier.
func IsIdentStart ¶
IsIdentStart returns true if the character is valid at the start of an identifier.
func NormalizeName ¶
NormalizeName normalizes to lowercase and Unicode Normalization Form C (NFC).
Types ¶
type EncodeFlags ¶
type EncodeFlags int
EncodeFlags influence the formatting of strings and identifiers.
const ( // EncNoFlags indicates nothing special should happen while encoding. EncNoFlags EncodeFlags = 0 // EncBareStrings indicates that strings will be rendered without // wrapping quotes if they contain no special characters. EncBareStrings EncodeFlags = 1 << iota // EncBareIdentifiers indicates that identifiers will be rendered // without wrapping quotes. EncBareIdentifiers // EncFirstFreeFlagBit needs to remain unused; it is used as base // bit offset for tree.FmtFlags. EncFirstFreeFlagBit )
func (EncodeFlags) HasFlags ¶
func (f EncodeFlags) HasFlags(subset EncodeFlags) bool
HasFlags tests whether the given flags are set.