Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeRawBytesToByteArray(data string, be BytesEncodeFormat) ([]byte, error)
- func DecodeRawBytesToByteArrayAuto(data []byte) ([]byte, error)
- func EncodeByteArrayToRawBytes(data string, be 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 BytesEncodeFormat
- type EncodeFlags
Constants ¶
const ABORT = 57370
const ACCESS = 57371
const ACTION = 57372
const ADD = 57373
const ADMIN = 57374
const AFTER = 57375
const AGGREGATE = 57376
const ALIGNMENT = 57377
const ALL = 57378
const ALLOW_CONNECTIONS = 57379
const ALTER = 57380
const ALWAYS = 57381
const ANALYSE = 57382
const ANALYZE = 57383
const AND = 57384
const AND_AND = 57385
const ANNOTATE_TYPE = 57387
const ANY = 57386
const ARRAY = 57388
const AS = 57389
const ASC = 57390
const ASSIGNMENT = 57391
const ASYMMETRIC = 57392
const AS_LA = 58050
const AT = 57393
const ATOMIC = 57394
const ATTACH = 57395
const ATTRIBUTE = 57396
const AUTHORIZATION = 57397
const AUTO = 57398
const AUTOMATIC = 57399
const BACKUP = 57400
const BACKUPS = 57401
const BASETYPE = 57402
const BCONST = 57348
const BEFORE = 57403
const BEGIN = 57404
const BETWEEN = 57405
const BIGINT = 57406
const BIGSERIAL = 57407
const BINARY = 57408
const BIT = 57409
const BITCONST = 57349
const BLOCK_COMMENT = 57454
const BOOLEAN = 57414
const BOTH = 57415
const BOX2D = 57416
const BPCHAR = 57435
const BUCKET_COUNT = 57413
const BUFFER_USAGE_LIMIT = 57417
const BUNDLE = 57418
const BY = 57419
const BYPASSRLS = 57420
const CACHE = 57421
const CALL = 57423
const CALLED = 57424
const CANCEL = 57425
const CANCELQUERY = 57426
const CANONICAL = 57427
const CASCADE = 57428
const CASCADED = 57429
const CASE = 57430
const CAST = 57431
const CATEGORY = 57432
const CBRT = 57433
const CHAIN = 57422
const CHANGEFEED = 57434
const CHAR = 57436
const CHARACTER = 57437
const CHARACTERISTICS = 57438
const CHECK = 57439
const CHECK_OPTION = 57440
const CLASS = 57441
const CLOSE = 57442
const CLUSTER = 57443
const COALESCE = 57444
const COLLATABLE = 57445
const COLLATE = 57446
const COLLATION = 57447
const COLLATION_VERSION = 57448
const COLUMN = 57449
const COLUMNS = 57450
const COMBINEFUNC = 57451
const COMMENT = 57452
const COMMENTS = 57453
const COMMIT = 57456
const COMMITTED = 57457
const COMMUTATOR = 57458
const COMPACT = 57459
const COMPLETE = 57460
const COMPRESSION = 57461
const CONCAT = 57462
const CONCURRENTLY = 57463
const CONFIGURATION = 57464
const CONFIGURATIONS = 57465
const CONFIGURE = 57466
const CONFLICT = 57467
const CONNECT = 57468
const CONNECTION = 57469
const CONSTRAINT = 57470
const CONSTRAINTS = 57471
const CONTAINED_BY = 58052
const CONTAINS = 57472
const CONTROLCHANGEFEED = 57473
const CONTROLJOB = 57474
const CONVERSION = 57475
const CONVERT = 57476
const COPY = 57477
const COSINE_DISTANCE = 57364
const COST = 57478
const CREATE = 57479
const CREATEDB = 57480
const CREATELOGIN = 57481
const CREATEROLE = 57482
const CROSS = 57483
const CSV = 57411
const CUBE = 57484
const CURRENT = 57485
const CURRENT_CATALOG = 57486
const CURRENT_DATE = 57487
const CURRENT_ROLE = 57489
const CURRENT_SCHEMA = 57488
const CURRENT_TIME = 57490
const CURRENT_TIMESTAMP = 57491
const CURRENT_USER = 57492
const CYCLE = 57493
const DATA = 57494
const DATABASE = 57495
const DATABASES = 57496
const DATE = 57497
const DAY = 57498
const DEALLOCATE = 57499
const DEC = 57500
const DECIMAL = 57501
const DECLARE = 57502
const DEFAULT = 57503
const DEFAULTS = 57504
const DEFERRABLE = 57505
const DEFERRED = 57506
const DEFINER = 57507
const DELETE = 57508
const DELIMITER = 57509
const DEPENDS = 57510
const DESC = 57511
const DESCRIBE = 57512
const DESERIALFUNC = 57513
const DESTINATION = 57514
const DETACH = 57515
const DETACHED = 57516
const DICTIONARY = 57517
const DISABLE = 57518
const DISABLE_PAGE_SKIPPING = 57519
const DISCARD = 57520
const DISTINCT = 57521
const DO = 57522
const DOMAIN = 57523
const DOT_DOT = 57355
const DOUBLE = 57524
const DROP = 57525
const EACH = 57526
const ELEMENT = 57527
const ELSE = 57528
const ENABLE = 57529
const ENCODING = 57530
const ENCRYPTED = 57532
const ENCRYPTION_PASSPHRASE = 57531
const END = 57533
const ENUM = 57534
const ENUMS = 57535
const ERROR = 57369
const ESCAPE = 57536
const EVENT = 57537
const EXCEPT = 57538
const EXCLUDE = 57539
const EXCLUDING = 57540
const EXECUTE = 57542
const EXECUTION = 57543
const EXISTS = 57541
const EXPERIMENTAL = 57544
const EXPERIMENTAL_AUDIT = 57547
const EXPERIMENTAL_FINGERPRINTS = 57545
const EXPERIMENTAL_REPLICA = 57546
const EXPIRATION = 57548
const EXPLAIN = 57549
const EXPORT = 57550
const EXPRESSION = 57551
const EXTENDED = 57552
const EXTENSION = 57553
const EXTERNAL = 57554
const EXTRACT = 57555
const EXTRACT_DURATION = 57556
const FALSE = 57557
const FAMILY = 57558
const FCONST = 57351
const FETCH = 57559
const FETCHTEXT = 57561
const FETCHTEXT_PATH = 57563
const FETCHVAL = 57560
const FETCHVAL_PATH = 57562
const FILES = 57564
const FILTER = 57565
const FINALFUNC = 57566
const FINALFUNC_EXTRA = 57567
const FINALFUNC_MODIFY = 57568
const FINALIZE = 57569
const FIRST = 57570
const FLOAT = 57571
const FLOAT4 = 57572
const FLOAT8 = 57573
const FLOORDIV = 57574
const FOLLOWING = 57575
const FOR = 57576
const FORCE = 57577
const FORCE_INDEX = 57578
const FOREIGN = 57579
const FORMAT = 57410
const FREEZE = 57580
const FROM = 57581
const FULL = 57582
const FUNCTION = 57583
const FUNCTIONS = 57584
const GENERATED = 57585
const GENERATED_ALWAYS = 58051
const GEOGRAPHY = 57586
const GEOMETRY = 57587
const GEOMETRYCOLLECTION = 57591
const GEOMETRYCOLLECTIONM = 57592
const GEOMETRYCOLLECTIONZ = 57593
const GEOMETRYCOLLECTIONZM = 57594
const GEOMETRYM = 57588
const GEOMETRYZ = 57589
const GEOMETRYZM = 57590
const GLOBAL = 57595
const GRANT = 57596
const GRANTED = 57597
const GRANTS = 57598
const GREATER_EQUALS = 57357
const GREATEST = 57599
const GROUP = 57600
const GROUPING = 57601
const GROUPS = 57602
const HAMMING_DISTANCE = 57367
const HANDLER = 57603
const HASH = 57604
const HASHES = 57605
const HAVING = 57606
const HEADER = 57412
const HELPTOKEN = 58055
const HIGH = 57607
const HINT = 57455
const HISTOGRAM = 57608
const HOUR = 57609
const HYPOTHETICAL = 57610
const ICONST = 57350
const ICU_LOCALE = 57611
const ICU_RULES = 57612
const IDENT = 57346
const IDENTITY = 57613
const IF = 57614
const IFERROR = 57615
const IFNULL = 57616
const IGNORE_FOREIGN_KEYS = 57617
const ILIKE = 57618
const IMMEDIATE = 57619
const IMMUTABLE = 57621
const IMPLICIT = 57620
const IMPORT = 57622
const IN = 57623
const INCLUDE = 57624
const INCLUDING = 57625
const INCREMENT = 57626
const INCREMENTAL = 57627
const INDEX = 57631
const INDEXES = 57633
const INDEX_CLEANUP = 57632
const INET = 57628
const INET_CONTAINED_BY_OR_EQUALS = 57629
const INET_CONTAINS_OR_EQUALS = 57630
const INHERIT = 57634
const INHERITS = 57635
const INITCOND = 57636
const INITIALLY = 57641
const INJECT = 57637
const INLINE = 57638
const INNER = 57642
const INOUT = 57643
const INPUT = 57639
const INSERT = 57644
const INSTEAD = 57645
const INT = 57646
const INTEGER = 57647
const INTERLEAVE = 57640
const INTERNALLENGTH = 57648
const INTERSECT = 57649
const INTERVAL = 57650
const INTO = 57651
const INTO_DB = 57652
const INVERTED = 57653
const INVOKER = 57654
const IS = 57655
const ISERROR = 57656
const ISNULL = 57657
const ISOLATION = 57658
const IS_TEMPLATE = 57659
const JACCARD_DISTANCE = 57366
const JOB = 57660
const JOBS = 57661
const JOIN = 57662
const JSON = 57663
const JSONB = 57664
const JSON_ALL_EXISTS = 57666
const JSON_SOME_EXISTS = 57665
const KEY = 57667
const KEYS = 57668
const KMS = 57669
const KV = 57670
const L1_DISTANCE = 57362
const L2_DISTANCE = 57363
const LANGUAGE = 57671
const LARGE = 57672
const LAST = 57673
const LATERAL = 57674
const LATEST = 57675
const LC_COLLATE = 57677
const LC_CTYPE = 57676
const LEADING = 57678
const LEAKPROOF = 57679
const LEASE = 57680
const LEAST = 57681
const LEFT = 57682
const LEFTARG = 57683
const LESS = 57684
const LESS_EQUALS = 57356
const LEVEL = 57685
const LIKE = 57686
const LIMIT = 57687
const LINESTRING = 57688
const LINESTRINGM = 57689
const LINESTRINGZ = 57690
const LINESTRINGZM = 57691
const LIST = 57692
const LOCAL = 57693
const LOCALE = 57694
const LOCALE_PROVIDER = 57695
const LOCALTIME = 57696
const LOCALTIMESTAMP = 57697
const LOCKED = 57698
const LOGGED = 57699
const LOGIN = 57700
const LOOKUP = 57701
const LOW = 57702
const LSHIFT = 57703
const MAIN = 57704
const MATCH = 57705
const MATERIALIZED = 57706
const MAXVALUE = 57707
const MERGE = 57708
const MERGES = 57709
const METHOD = 57710
const MFINALFUNC = 57711
const MFINALFUNC_EXTRA = 57712
const MFINALFUNC_MODIFY = 57713
const MINITCOND = 57714
const MINUTE = 57715
const MINVALUE = 57716
const MINVFUNC = 57717
const MODIFYCLUSTERSETTING = 57718
const MODULUS = 57719
const MONTH = 57720
const MSFUNC = 57721
const MSPACE = 57722
const MSSPACE = 57723
const MSTYPE = 57724
const MULTILINESTRING = 57725
const MULTILINESTRINGM = 57726
const MULTILINESTRINGZ = 57727
const MULTILINESTRINGZM = 57728
const MULTIPOINT = 57729
const MULTIPOINTM = 57730
const MULTIPOINTZ = 57731
const MULTIPOINTZM = 57732
const MULTIPOLYGON = 57733
const MULTIPOLYGONM = 57734
const MULTIPOLYGONZ = 57735
const MULTIPOLYGONZM = 57736
const MULTIRANGE_TYPE_NAME = 57737
const NAME = 57739
const NAMES = 57740
const NAN = 57738
const NATURAL = 57741
const NEGATOR = 57742
const NEG_INNER_PRODUCT = 57365
const NEVER = 57743
const NEW = 57744
const NEXT = 57745
const NO = 57746
const NOBYPASSRLS = 57750
const NOCANCELQUERY = 57747
const NOCONTROLCHANGEFEED = 57748
const NOCONTROLJOB = 57749
const NOCREATEDB = 57751
const NOCREATELOGIN = 57752
const NOCREATEROLE = 57753
const NOINHERIT = 57754
const NOLOGIN = 57755
const NOMODIFYCLUSTERSETTING = 57756
const NONE = 57760
const NOREPLICATION = 57757
const NORMAL = 57761
const NOSUPERUSER = 57758
const NOT = 57762
const NOTHING = 57763
const NOTNULL = 57764
const NOT_EQUALS = 57358
const NOT_LA = 58048
const NOT_REGIMATCH = 57361
const NOT_REGMATCH = 57359
const NOVIEWACTIVITY = 57765
const NOWAIT = 57766
const NO_INDEX_JOIN = 57759
const NULL = 57767
const NULLIF = 57768
const NULLS = 57769
const NUMERIC = 57770
const OBJECT = 57772
const OF = 57773
const OFF = 57774
const OFFSET = 57775
const OID = 57776
const OIDS = 57777
const OIDVECTOR = 57778
const OLD = 57779
const ON = 57780
const ONLY = 57781
const ONLY_DATABASE_STATS = 57782
const OPERATOR = 57798
const OPT = 57783
const OPTION = 57784
const OPTIONS = 57785
const OR = 57786
const ORDER = 57787
const ORDINALITY = 57788
const OTHERS = 57789
const OUT = 57790
const OUTER = 57791
const OUTPUT = 57792
const OVER = 57793
const OVERLAPS = 57794
const OVERLAY = 57795
const OWNED = 57796
const OWNER = 57797
const PARALLEL = 57799
const PARAMETER = 57800
const PARENT = 57801
const PARSER = 57802
const PARTIAL = 57803
const PARTITION = 57804
const PARTITIONS = 57805
const PASSEDBYVALUE = 57806
const PASSWORD = 57807
const PAUSE = 57808
const PAUSED = 57809
const PHYSICAL = 57810
const PLACEHOLDER = 57352
const PLACING = 57811
const PLAIN = 57812
const PLAN = 57813
const PLANS = 57814
const POINT = 57815
const POINTM = 57816
const POINTZ = 57817
const POINTZM = 57818
const POLICY = 57819
const POLYGON = 57820
const POLYGONM = 57821
const POLYGONZ = 57822
const POLYGONZM = 57823
const POSITION = 57824
const POSTFIXOP = 58053
const PRECEDING = 57825
const PRECISION = 57826
const PREFERRED = 57827
const PREPARE = 57828
const PRESERVE = 57829
const PRIMARY = 57830
const PRIORITY = 57831
const PRIVILEGES = 57832
const PROCEDURAL = 57833
const PROCEDURE = 57834
const PROCEDURES = 57835
const PROCESS_MAIN = 57836
const PROCESS_TOAST = 57837
const PUBLIC = 57838
const PUBLICATION = 57839
const QUERIES = 57840
const QUERY = 57841
const RANGE = 57842
const RANGES = 57843
const READ = 57844
const READ_ONLY = 57845
const READ_WRITE = 57846
const REAL = 57847
const RECEIVE = 57848
const RECURRING = 57850
const RECURSIVE = 57849
const REF = 57851
const REFERENCES = 57852
const REFERENCING = 57853
const REFRESH = 57854
const REGCLASS = 57855
const REGIMATCH = 57360
const REGNAMESPACE = 57858
const REGPROC = 57856
const REGPROCEDURE = 57857
const REGTYPE = 57859
const REINDEX = 57860
const RELEASE = 57861
const REMAINDER = 57862
const REMOVE_PATH = 57863
const RENAME = 57864
const REPEATABLE = 57865
const REPLACE = 57866
const REPLICA = 57867
const REPLICATION = 57868
const RESET = 57869
const RESTART = 57870
const RESTORE = 57871
const RESTRICT = 57872
const RESTRICTED = 57873
const RESUME = 57874
const RETRY = 57875
const RETURN = 57876
const RETURNING = 57877
const RETURNS = 57878
const REVISION_HISTORY = 57879
const REVOKE = 57880
const RIGHT = 57881
const RIGHTARG = 57882
const ROLE = 57883
const ROLES = 57884
const ROLLBACK = 57887
const ROLLUP = 57888
const ROUTINE = 57885
const ROUTINES = 57886
const ROW = 57889
const ROWS = 57890
const RSHIFT = 57891
const RULE = 57892
const RUNNING = 57893
const SAFE = 57894
const SAVEPOINT = 57895
const SCATTER = 57896
const SCHEDULE = 57897
const SCHEDULES = 57898
const SCHEMA = 57899
const SCHEMAS = 57900
const SCONST = 57347
const SCRUB = 57901
const SEARCH = 57902
const SECOND = 57903
const SECURITY = 57904
const SECURITY_BARRIER = 57905
const SECURITY_INVOKER = 57906
const SEED = 57907
const SELECT = 57908
const SEND = 57909
const SEQUENCE = 57920
const SEQUENCES = 57921
const SERIALFUNC = 57910
const SERIALIZABLE = 57911
const SERVER = 57912
const SESSION = 57913
const SESSIONS = 57914
const SESSION_USER = 57915
const SET = 57916
const SETOF = 57917
const SETTING = 57918
const SETTINGS = 57919
const SFUNC = 57922
const SHARE = 57923
const SHAREABLE = 57924
const SHOW = 57925
const SIMILAR = 57926
const SIMPLE = 57927
const SKIP = 57928
const SKIP_DATABASE_STATS = 57930
const SKIP_LOCKED = 57929
const SKIP_MISSING_FOREIGN_KEYS = 57931
const SKIP_MISSING_SEQUENCES = 57932
const SKIP_MISSING_SEQUENCE_OWNERS = 57933
const SKIP_MISSING_VIEWS = 57934
const SMALLINT = 57935
const SMALLSERIAL = 57936
const SNAPSHOT = 57937
const SOME = 57938
const SORTOP = 57939
const SPLIT = 57940
const SQL = 57941
const SQRT = 57942
const SSPACE = 57943
const STABLE = 57944
const START = 57945
const STATEMENT = 57946
const STATISTICS = 57947
const STATUS = 57948
const STDIN = 57949
const STDOUT = 57950
const STORAGE = 57954
const STORE = 57955
const STORED = 57956
const STRATEGY = 57951
const STRICT = 57952
const STRING = 57953
const STYPE = 57957
const SUBSCRIPT = 57958
const SUBSCRIPTION = 57959
const SUBSTRING = 57960
const SUBTYPE = 57961
const SUBTYPE_DIFF = 57962
const SUBTYPE_OPCLASS = 57963
const SUPERUSER = 57964
const SUPPORT = 57965
const SYMMETRIC = 57966
const SYNTAX = 57967
const SYSID = 57968
const SYSTEM = 57969
const TABLE = 57970
const TABLES = 57971
const TABLESPACE = 57972
const TEMP = 57973
const TEMPLATE = 57974
const TEMPORARY = 57975
const TEXT = 57976
const TEXTSEARCHMATCH = 57368
const THEN = 57977
const THROTTLING = 57984
const TIES = 57978
const TIME = 57979
const TIMESTAMP = 57981
const TIMESTAMPTZ = 57982
const TIMETZ = 57980
const TO = 57983
const TRACE = 57986
const TRACING = 57987
const TRAILING = 57985
const TRANSACTION = 57988
const TRANSACTIONS = 57989
const TRANSFORM = 57990
const TREAT = 57991
const TRIGGER = 57992
const TRIM = 57993
const TRUE = 57994
const TRUNCATE = 57995
const TRUSTED = 57996
const TYPE = 57997
const TYPEANNOTATE = 57354
const TYPECAST = 57353
const TYPES = 57998
const TYPMOD_IN = 57999
const TYPMOD_OUT = 58000
const UMINUS = 58054
const UNBOUNDED = 58001
const UNCOMMITTED = 58002
const UNION = 58003
const UNIQUE = 58004
const UNKNOWN = 58005
const UNLOGGED = 58006
const UNSAFE = 58007
const UNSPLIT = 58008
const UNTIL = 58011
const UPDATE = 58009
const UPSERT = 58010
const USAGE = 58012
const USE = 58013
const USER = 58014
const USERS = 58015
const USING = 58016
const UUID = 58017
const VACUUM = 58018
const VALID = 58019
const VALIDATE = 58020
const VALIDATOR = 58021
const VALUE = 58022
const VALUES = 58023
const VARBIT = 58025
const VARCHAR = 58026
const VARIABLE = 58027
const VARIADIC = 58028
const VARYING = 58029
const VERBOSE = 58024
const VERSION = 58030
const VIEW = 58031
const VIEWACTIVITY = 58032
const VIRTUAL = 58033
const VOLATILE = 58034
const WHEN = 58035
const WHERE = 58036
const WINDOW = 58037
const WITH = 58038
const WITHIN = 58039
const WITHOUT = 58040
const WITH_LA = 58049
const WORK = 58041
const WRAPPER = 58042
const WRITE = 58043
const XML = 58044
const YAML = 58045
const YEAR = 58046
const YES = 57771
const ZONE = 58047
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{}/* 642 elements not displayed */
KeywordNames contains all keywords sorted, so that pg_get_keywords returns deterministic results.
var KeywordsCategories = map[string]string{}/* 642 elements not displayed */
Functions ¶
func DecodeRawBytesToByteArray ¶
func DecodeRawBytesToByteArray(data string, be 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 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 ¶ added in v0.57.3
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 BytesEncodeFormat ¶
type BytesEncodeFormat int
BytesEncodeFormat controls which format to use for BYTES->STRING conversions.
const ( // BytesEncodeHex uses the hex format: e'abc\n'::BYTES::STRING -> '\x61626312'. // This is the default, for compatibility with PostgreSQL. BytesEncodeHex BytesEncodeFormat = iota // BytesEncodeEscape uses the escaped format: e'abc\n'::BYTES::STRING -> 'abc\012'. BytesEncodeEscape // BytesEncodeBase64 uses base64 encoding. BytesEncodeBase64 )
func BytesEncodeFormatFromString ¶
func BytesEncodeFormatFromString(val string) (_ BytesEncodeFormat, ok bool)
BytesEncodeFormatFromString converts a string into a BytesEncodeFormat.
func (BytesEncodeFormat) String ¶
func (f BytesEncodeFormat) String() string
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.