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