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