types

package
v0.0.0-...-34dd132 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitBool

type BitBool bool

BitBool is an implementation of a bool for the MySQL type BIT(1). This type allows you to avoid wasting an entire byte for MySQL's boolean type TINYINT.

func (*BitBool) Scan

func (b *BitBool) Scan(src interface{}) error

Scan implements the sql.Scanner interface, and turns the bitfield incoming from MySQL into a BitBool

func (BitBool) Value

func (b BitBool) Value() (driver.Value, error)

Value implements the driver.Valuer interface, and turns the BitBool into a bitfield (BIT(1)) for MySQL storage.

type DateText

type DateText string

DateText date text

func (*DateText) Scan

func (t *DateText) Scan(src interface{}) error

Scan implements the sql.Scanner interface

func (DateText) Value

func (t DateText) Value() (driver.Value, error)

Value implements the driver.Valuer interface

type FloatNull

type FloatNull float64

FloatNull is an implementation of a int for the MySQL type numeric ....

func (*FloatNull) Scan

func (n *FloatNull) Scan(src interface{}) error

Scan implements the sql.Scanner interface, and turns the bytes incoming from MySQL into a numeric

func (FloatNull) Value

func (n FloatNull) Value() (driver.Value, error)

Value implements the driver.Valuer interface, and turns the bytes into a integer for MySQL storage.

type GzippedText

type GzippedText []byte

GzippedText is a []byte which transparently gzips data being submitted to a database and ungzips data being Scanned from a database.

func (*GzippedText) Scan

func (g *GzippedText) Scan(src interface{}) error

Scan implements the sql.Scanner interface, ungzipping the value coming off the wire and storing the raw result in the GzippedText.

func (GzippedText) Value

func (g GzippedText) Value() (driver.Value, error)

Value implements the driver.Valuer interface, gzipping the raw value of this GzippedText.

type IntNull

type IntNull int

IntNull is an implementation of a int for the MySQL type int/tinyint ....

func (*IntNull) Scan

func (n *IntNull) Scan(src interface{}) error

Scan implements the sql.Scanner interface, and turns the bytes incoming from MySQL into a integer

func (IntNull) Value

func (n IntNull) Value() (driver.Value, error)

Value implements the driver.Valuer interface, and turns the bytes into a integer for MySQL storage.

type JSONText

type JSONText json.RawMessage

JSONText is a json.RawMessage, which is a []byte underneath. Value() validates the json format in the source, and returns an error if the json is not valid. Scan does no validation. JSONText additionally implements `Unmarshal`, which unmarshals the json within to an interface{}

func (JSONText) MarshalJSON

func (j JSONText) MarshalJSON() ([]byte, error)

MarshalJSON returns the *j as the JSON encoding of j.

func (*JSONText) Scan

func (j *JSONText) Scan(src interface{}) error

Scan stores the src in *j. No validation is done.

func (JSONText) String

func (j JSONText) String() string

String supports pretty printing for JSONText types.

func (*JSONText) Unmarshal

func (j *JSONText) Unmarshal(v interface{}) error

Unmarshal unmarshal's the json in j to v, as in json.Unmarshal.

func (*JSONText) UnmarshalJSON

func (j *JSONText) UnmarshalJSON(data []byte) error

UnmarshalJSON sets *j to a copy of data

func (JSONText) Value

func (j JSONText) Value() (driver.Value, error)

Value returns j as a value. This does a validating unmarshal into another RawMessage. If j is invalid json, it returns an error.

type NullJSONText

type NullJSONText struct {
	JSONText
	Valid bool // Valid is true if JSONText is not NULL
}

NullJSONText represents a JSONText that may be null. NullJSONText implements the scanner interface so it can be used as a scan destination, similar to NullString.

func (*NullJSONText) Scan

func (n *NullJSONText) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullJSONText) Value

func (n NullJSONText) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type TextNull

type TextNull string

TextNull is an implementation of a string for the MySQL type char/varchar/text ....

func (*TextNull) Scan

func (s *TextNull) Scan(src interface{}) error

Scan implements the sql.Scanner interface, and turns the bytes incoming from MySQL into a string

func (TextNull) Value

func (s TextNull) Value() (driver.Value, error)

Value implements the driver.Valuer interface, and turns the string into a bytes for MySQL storage.

type TimeText

type TimeText string

TimeText time text

func (*TimeText) Scan

func (t *TimeText) Scan(src interface{}) error

Scan implements the sql.Scanner interface

func (TimeText) Value

func (t TimeText) Value() (driver.Value, error)

Value implements the driver.Valuer interface

Jump to

Keyboard shortcuts

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