Documentation ¶
Index ¶
Constants ¶
View Source
const ( Select = "SELECT" From = "FROM" Where = "WHERE" Order = "ORDER" OrderBy = "ORDER BY" Limit = "LIMIT" Offset = "OFFSET" Group = "GROUP" GroupBy = "GROUP BY" Having = "HAVING" Insert = "INSERT INTO" Update = "UPDATE" Delete = "DELETE FROM" Create = "CREATE" Alter = "ALTER" Drop = "DROP" Truncate = "TRUNCATE" Join = "JOIN" Inner = "INNER" Outer = "OUTER" Left = "LEFT" Right = "RIGHT" LeftJoin = "LEFT JOIN" RightJoin = "RIGHT JOIN" InnerJoin = "INNER JOIN" OuterJoin = "OUTER JOIN" On = "ON" As = "AS" And = "AND" Or = "OR" Not = "NOT" Between = "BETWEEN" In = "IN" Like = "LIKE" Exists = "EXISTS" All = "ALL" Any = "ANY" Union = "UNION" Intersect = "INTERSECT" Except = "EXCEPT" Asc = "ASC" Desc = "DESC" IsNull = "IS NULL" IsNotNull = "IS NOT NULL" End = "END" With = "WITH" )
Variables ¶
View Source
var ReservedKeywords = map[string]struct{}{ Select: {}, From: {}, Where: {}, Order: {}, OrderBy: {}, Limit: {}, Offset: {}, Group: {}, GroupBy: {}, Having: {}, Insert: {}, Update: {}, Delete: {}, Create: {}, Alter: {}, Drop: {}, Truncate: {}, Join: {}, Inner: {}, Outer: {}, Left: {}, Right: {}, LeftJoin: {}, RightJoin: {}, InnerJoin: {}, OuterJoin: {}, On: {}, As: {}, And: {}, Or: {}, Not: {}, Between: {}, In: {}, Like: {}, Exists: {}, All: {}, Any: {}, Union: {}, Intersect: {}, Except: {}, Asc: {}, Desc: {}, IsNull: {}, IsNotNull: {}, End: {}, With: {}, }
ReservedKeywords contains all reserved keywords in PostgreSQL
Functions ¶
func IsReservedKeyword ¶
func IsReservedSymbol ¶
func IsValidDataType ¶
IsValidDataType checks if the given value is a valid DataType constant.
Types ¶
type DataType ¶
type DataType string
const ( // smallIntType represents a small-range integer in PostgreSQL. SmallIntType DataType = "smallint" // 2 bytes, range: -32768 to +32767 // intType represents a typical choice for an integer in PostgreSQL. IntType DataType = "integer" // 4 bytes, range: -2147483648 to +2147483647 // bigIntType represents a large-range integer in PostgreSQL. BigIntType DataType = "bigint" // 8 bytes, range: -9223372036854775808 to +9223372036854775807 // decimalType represents a user-specified precision decimal in PostgreSQL. DecimalType DataType = "decimal" // Variable precision, exact, up to 131072 digits before the decimal point; up to 16383 digits after the decimal point // numericType represents a user-specified precision numeric in PostgreSQL. NumericType DataType = "numeric" // Variable precision, exact, up to 131072 digits before the decimal point; up to 16383 digits after the decimal point // realType represents a variable-precision, inexact real number in PostgreSQL. RealType DataType = "real" // 4 bytes, 6 decimal digits precision // doublePrecisionType represents a variable-precision, inexact double precision number in PostgreSQL. DoublePrecisionType DataType = "double precision" // 8 bytes, 15 decimal digits precision DoublePrecisionTypeAlias DataType = "float8" // smallSerialType represents a small auto-incrementing integer in PostgreSQL. SmallSerialType DataType = "smallserial" // 2 bytes, range: 1 to 32767 // serialType represents an auto-incrementing integer in PostgreSQL. SerialType DataType = "serial" // 4 bytes, range: 1 to 2147483647 // bigSerialType represents a large auto-incrementing integer in PostgreSQL. BigSerialType DataType = "bigserial" // 8 bytes, range: 1 to 9223372036854775807 // varcharType represents a variable-length character type with a specified limit in PostgreSQL. VarcharType DataType = "character varying" // Variable-length with limit VarcharTypeAlias DataType = "varchar" // charType represents a fixed-length character type in PostgreSQL. CharType DataType = "char" // Fixed-length, blank-padded // bpcharType represents a fixed-length character type (blank-padded) in PostgreSQL. BpcharType DataType = "bpchar" // Fixed-length, blank-padded (alternative representation) // textType represents a variable-length character type with unlimited length in PostgreSQL. TextType DataType = "text" // Variable unlimited length // timestampType represents a timestamp with both date and time in PostgreSQL. TimestampType DataType = "timestamp without time zone" // 8 bytes, date and time (no time zone), 1 microsecond TimestampTypeAlias DataType = "timestamp" // timestampTzType represents a timestamp with both date and time, with time zone in PostgreSQL. TimestampTzType DataType = "timestamp with time zone" // 8 bytes, date and time with time zone, 1 microsecond TimestampTzTypeAlias DataType = "timestampz" // dateType represents a date (no time of day) in PostgreSQL. DateType DataType = "date" // 4 bytes, date (no time of day), 1 day // timeType represents a time of day (no date) in PostgreSQL. TimeType DataType = "time without time zone" // 8 bytes, time of day (no date), 1 microsecond TimeTypeAlias DataType = "time" // timeTzType represents a time of day (no date), with time zone in PostgreSQL. TimeTzType DataType = "time with time zone" // 12 bytes, time of day with time zone, 1 microsecond TimeTzTypeAlias DataType = "timez" // intervalType represents a time interval in PostgreSQL. IntervalType DataType = "interval" // 16 bytes, time interval, 1 microsecond // ----- Boolean Type ----- BooleanType DataType = "boolean" // uuidType represents the UUID data type in PostgreSQL. UuidType DataType = "uuid" // jsonType represents the JSON data type in PostgreSQL. JsonType DataType = "json" // jsonbType represents the JSONB data type in PostgreSQL. JsonbType DataType = "jsonb" )
func GetPgDataTypeName ¶
func ToPostgresType ¶
ToPostgresType converts a Go type to its corresponding PostgreSQL data type.
Click to show internal directories.
Click to hide internal directories.