datatype

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Integer    = idInteger | metaNumeric | metaInteger | metaSignable | metaHasGoUnisgned
	TinyInt    = idTinyInt | metaNumeric | metaInteger | metaSignable | metaHasGoUnisgned
	SmallInt   = idSmallInt | metaNumeric | metaInteger | metaSignable | metaHasGoUnisgned
	MediumInt  = idMediumInt | metaNumeric | metaInteger | metaSignable | metaHasGoUnisgned
	BigInt     = idBigInt | metaNumeric | metaInteger | metaSignable | metaHasGoUnisgned
	Decimal    = idDecimal | metaNumeric | metaSignable | metaRequiresParams
	Varchar    = idVarchar | metaString
	Text       = idText | metaString
	TinyText   = idTinyText | metaString
	MediumText = idMediumText | metaString
	LongText   = idLongText | metaString
	Char       = idChar | metaString
	Blob       = idBlob | metaBinary
	Enum       = idEnum | metaString | metaRequiresParams
	Boolean    = idBoolean
	Date       = idDate | metaTime
	DateTime   = idDateTime | metaTime
	Time       = idTime | metaTime
	Timestamp  = idTimestamp | metaTime
	Year       = idYear | metaTime
)

These are the actual Datatype constants with all the metadata and unique identifiers encoded into them

Variables

View Source
var ErrUnknownDatatype = errors.New("invalid datatype")

ErrUnknownDatatype is the error returned by functions when an unknown or invalid datatype is used

Functions

This section is empty.

Types

type Datatype

type Datatype uint64

Datatype is used to encode information about types for use in repository or validation The least-significant 8 bits are reserved for general metadata The next 16 bits are not currently used. They were historically reserved for DBMS support in the early concept stage. The next 8 bits are reserved for unique type identification The last 32 bits are not currently used

func FromString

func FromString(in string) (dt Datatype, err error)

FromString returns the decoded Datatype, and an error if the in string is invalid or unknown

func (Datatype) GoTypeString

func (dt Datatype) GoTypeString() (s string)

func (Datatype) HasGoUnsigned

func (dt Datatype) HasGoUnsigned() bool

HasGoUnsigned returns true if the Datatype has an unsigned variant Go type like int and uint

func (Datatype) IsBinary

func (dt Datatype) IsBinary() bool

IsBinary returns true if the Datatype is a blob/binary type.

func (Datatype) IsInt

func (dt Datatype) IsInt() bool

IsInt returns true if the Datatype is an integer type

func (Datatype) IsNumeric

func (dt Datatype) IsNumeric() bool

IsNumeric returns true if the Datatype is a numeric type.

func (Datatype) IsSignable

func (dt Datatype) IsSignable() bool

IsSignable returns true if the Datatype can be stored as either a signed or unsigned value

func (Datatype) IsString

func (dt Datatype) IsString() bool

IsString returns true if the Datatype is a string type

func (Datatype) IsTime

func (dt Datatype) IsTime() bool

IsTime returns true if the Datatype is a time type

func (Datatype) MarshalYAML

func (dt Datatype) MarshalYAML() (interface{}, error)

MarshalYAML provides an implementation for yaml/v2.Marshaler, returns a string representation of the Datatype

func (Datatype) RequiresParams

func (dt Datatype) RequiresParams() bool

RequiresParams returns true if the Datatype requires parameters in SQL syntax. The `(8, 5)` in SQL's `DECIMAL(8, 5)` for example

func (Datatype) String

func (dt Datatype) String() (s string)

func (*Datatype) UnmarshalYAML

func (dt *Datatype) UnmarshalYAML(value *yaml.Node) (err error)

UnmarshalYAML provides an implementation for yaml/v2.Unmarshaler to parse the yaml config

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL