gosql

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: MIT Imports: 8 Imported by: 0

README

gosql

Library of standart sql types like:

  • Char
  • Arrays (int, uint, string) nullable and not
  • JSON

License MIT

LICENSE

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidScan         = errors.New("invalid field scan")
	ErrNullValueNotAllowed = errors.New("nil value not allowed")
	ErrInvalidDecodeValue  = errors.New("invalid decode value")
)

Set of errors

Functions

func Float32ArrayDecode

func Float32ArrayDecode(data interface{}) (result []float32, err error)

Float32ArrayDecode decodes array of type float32

func Float32ArrayEncode

func Float32ArrayEncode(begin, end byte, arr []float32) *bytes.Buffer

Float32ArrayEncode encodes array of type float32

func Float64ArrayDecode

func Float64ArrayDecode(data interface{}) (result []float64, err error)

Float64ArrayDecode decodes array of type float64

func Float64ArrayEncode

func Float64ArrayEncode(begin, end byte, arr []float64) *bytes.Buffer

Float64ArrayEncode encodes array of type float64

func Int16ArrayDecode

func Int16ArrayDecode(data interface{}) (result []int16, err error)

Int16ArrayDecode decodes array of type int16

func Int16ArrayEncode

func Int16ArrayEncode(begin, end byte, arr []int16) *bytes.Buffer

Int16ArrayEncode encodes array of type int16

func Int32ArrayDecode

func Int32ArrayDecode(data interface{}) (result []int32, err error)

Int32ArrayDecode decodes array of type int32

func Int32ArrayEncode

func Int32ArrayEncode(begin, end byte, arr []int32) *bytes.Buffer

Int32ArrayEncode encodes array of type int32

func Int64ArrayDecode

func Int64ArrayDecode(data interface{}) (result []int64, err error)

Int64ArrayDecode decodes array of type int64

func Int64ArrayEncode

func Int64ArrayEncode(begin, end byte, arr []int64) *bytes.Buffer

Int64ArrayEncode encodes array of type int64

func Int8ArrayDecode

func Int8ArrayDecode(data interface{}) (result []int8, err error)

Int8ArrayDecode decodes array of type int8

func Int8ArrayEncode

func Int8ArrayEncode(begin, end byte, arr []int8) *bytes.Buffer

Int8ArrayEncode encodes array of type int8

func IntArrayDecode

func IntArrayDecode(data interface{}) (result []int, err error)

IntArrayDecode decodes array of type int

func IntArrayEncode

func IntArrayEncode(begin, end byte, arr []int) *bytes.Buffer

IntArrayEncode encodes array of type int

func Uint16ArrayDecode

func Uint16ArrayDecode(data interface{}) (result []uint16, err error)

Uint16ArrayDecode decodes array of type uint16

func Uint16ArrayEncode

func Uint16ArrayEncode(begin, end byte, arr []uint16) *bytes.Buffer

Uint16ArrayEncode encodes array of type uint16

func Uint32ArrayDecode

func Uint32ArrayDecode(data interface{}) (result []uint32, err error)

Uint32ArrayDecode decodes array of type uint32

func Uint32ArrayEncode

func Uint32ArrayEncode(begin, end byte, arr []uint32) *bytes.Buffer

Uint32ArrayEncode encodes array of type uint32

func Uint64ArrayDecode

func Uint64ArrayDecode(data interface{}) (result []uint64, err error)

Uint64ArrayDecode decodes array of type uint64

func Uint64ArrayEncode

func Uint64ArrayEncode(begin, end byte, arr []uint64) *bytes.Buffer

Uint64ArrayEncode encodes array of type uint64

func Uint8ArrayDecode

func Uint8ArrayDecode(data interface{}) (result []uint8, err error)

Uint8ArrayDecode decodes array of type uint8

func Uint8ArrayEncode

func Uint8ArrayEncode(begin, end byte, arr []uint8) *bytes.Buffer

Uint8ArrayEncode encodes array of type uint8

func UintArrayDecode

func UintArrayDecode(data interface{}) (result []uint, err error)

UintArrayDecode decodes array of type uint

func UintArrayEncode

func UintArrayEncode(begin, end byte, arr []uint) *bytes.Buffer

UintArrayEncode encodes array of type uint

Types

type Char

type Char rune

Char type of field

func (Char) MarshalJSON

func (f Char) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler

func (*Char) Scan

func (f *Char) Scan(value interface{}) (err error)

Scan implements the sql.Scanner interface, char field

func (*Char) UnmarshalJSON

func (f *Char) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implements the json.Unmarshaller

func (Char) Value

func (f Char) Value() (driver.Value, error)

Value implements the driver.Valuer interface, char field

type IntArray

type IntArray NullableIntArray

IntArray type of field

func (*IntArray) DecodeValue

func (f *IntArray) DecodeValue(v interface{}) error

DecodeValue implements the gocast.Decoder

func (IntArray) Filter

func (f IntArray) Filter(fn func(v int) (int, bool)) (resp IntArray)

Filter current array and create filtered copy

func (IntArray) IndexOf

func (f IntArray) IndexOf(v int) int

IndexOf array value

func (IntArray) Len

func (f IntArray) Len() int

Len of array

func (IntArray) OneOf

func (f IntArray) OneOf(vals []int) bool

OneOf value in array

func (IntArray) Ordered

func (f IntArray) Ordered() OrderedIntArray

Ordered object

func (*IntArray) Scan

func (f *IntArray) Scan(value interface{}) error

Scan implements the driver.Valuer interface, []int field

func (IntArray) Sort

func (f IntArray) Sort()

Sort ints array

func (*IntArray) UnmarshalJSON

func (f *IntArray) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (IntArray) Value

func (f IntArray) Value() (driver.Value, error)

Value implements the driver.Valuer interface, []int field

type JSON

type JSON NullableJSON

JSON field

func NewJSON

func NewJSON(v ...interface{}) (*JSON, error)

NewJSON field object

func (*JSON) DecodeValue

func (f *JSON) DecodeValue(v interface{}) (err error)

DecodeValue implements the gocast.Decoder

func (JSON) MarshalJSON

func (f JSON) MarshalJSON() ([]byte, error)

MarshalJSON Implement json.Marshaler

func (*JSON) Scan

func (f *JSON) Scan(value interface{}) error

Scan implements the driver.Valuer interface, json field interface

func (*JSON) UnmarshalJSON

func (f *JSON) UnmarshalJSON(b []byte) error

UnmarshalJSON Implement json.Unmarshaller

func (JSON) Value

func (f JSON) Value() (driver.Value, error)

Value implements the driver.Valuer interface, json field interface

type NullableIntArray

type NullableIntArray []int

NullableIntArray type of field

func (*NullableIntArray) DecodeValue

func (f *NullableIntArray) DecodeValue(v interface{}) error

DecodeValue implements the gocast.Decoder

func (NullableIntArray) Filter

func (f NullableIntArray) Filter(fn func(v int) (int, bool)) (resp NullableIntArray)

Filter current array and create filtered copy

func (NullableIntArray) IndexOf

func (f NullableIntArray) IndexOf(v int) int

IndexOf array value

func (NullableIntArray) Len

func (f NullableIntArray) Len() int

Len of array

func (NullableIntArray) MarshalJSON

func (f NullableIntArray) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler

func (NullableIntArray) OneOf

func (f NullableIntArray) OneOf(vals []int) bool

OneOf value in array

func (NullableIntArray) Ordered

Ordered object

func (*NullableIntArray) Scan

func (f *NullableIntArray) Scan(value interface{}) error

Scan implements the driver.Valuer interface, []int field

func (NullableIntArray) Sort

func (f NullableIntArray) Sort()

Sort ints array

func (*NullableIntArray) UnmarshalJSON

func (f *NullableIntArray) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (NullableIntArray) Value

func (f NullableIntArray) Value() (driver.Value, error)

Value implements the driver.Valuer interface, []int field

type NullableJSON

type NullableJSON struct {
	// contains filtered or unexported fields
}

NullableJSON field

func NewNullableJSON

func NewNullableJSON(v ...interface{}) (jobj *NullableJSON, err error)

NewNullableJSON field object

func (NullableJSON) Bytes

func (f NullableJSON) Bytes() []byte

Bytes body

func (*NullableJSON) DecodeValue

func (f *NullableJSON) DecodeValue(v interface{}) (err error)

DecodeValue implements the gocast.Decoder

func (NullableJSON) Length

func (f NullableJSON) Length() int

Length of the body

func (NullableJSON) MarshalJSON

func (f NullableJSON) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler

func (*NullableJSON) Scan

func (f *NullableJSON) Scan(value interface{}) error

Scan implements the driver.Valuer interface, json field interface

func (*NullableJSON) SetValue

func (f *NullableJSON) SetValue(value interface{}) (err error)

SetValue of json

func (*NullableJSON) String

func (f *NullableJSON) String() string

String value

func (*NullableJSON) UnmarshalJSON

func (f *NullableJSON) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (*NullableJSON) UnmarshalTo

func (f *NullableJSON) UnmarshalTo(v interface{}) (err error)

UnmarshalTo object

func (NullableJSON) Value

func (f NullableJSON) Value() (_ driver.Value, err error)

Value implements the driver.Valuer interface, json field interface

type NullableOrderedIntArray

type NullableOrderedIntArray NullableIntArray

NullableOrderedIntArray type of field

func (*NullableOrderedIntArray) DecodeValue

func (f *NullableOrderedIntArray) DecodeValue(v interface{}) (err error)

DecodeValue implements the gocast.Decoder

func (NullableOrderedIntArray) Filter

func (f NullableOrderedIntArray) Filter(fn func(v int) (int, bool)) (resp NullableOrderedIntArray)

Filter current array and create filtered copy

func (NullableOrderedIntArray) IndexOf

func (f NullableOrderedIntArray) IndexOf(v int) int

IndexOf array value

func (NullableOrderedIntArray) Len

func (f NullableOrderedIntArray) Len() int

Len of array

func (NullableOrderedIntArray) OneOf

func (f NullableOrderedIntArray) OneOf(vals []int) bool

OneOf value in array

func (*NullableOrderedIntArray) Scan

func (f *NullableOrderedIntArray) Scan(value interface{}) (err error)

Scan implements the driver.Valuer interface, []int field

func (NullableOrderedIntArray) Sort

func (f NullableOrderedIntArray) Sort()

Sort ints array

func (*NullableOrderedIntArray) UnmarshalJSON

func (f *NullableOrderedIntArray) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implements the json.Unmarshaller

func (NullableOrderedIntArray) Value

Value implements the driver.Valuer interface, []int field

type NullableOrderedUintArray

type NullableOrderedUintArray NullableUintArray

NullableOrderedUintArray type of field

func (*NullableOrderedUintArray) DecodeValue

func (f *NullableOrderedUintArray) DecodeValue(v interface{}) (err error)

DecodeValue implements the gocast.Decoder

func (NullableOrderedUintArray) Filter

func (f NullableOrderedUintArray) Filter(fn func(v uint) (uint, bool)) (resp NullableOrderedUintArray)

Filter current array and create filtered copy

func (NullableOrderedUintArray) IndexOf

func (f NullableOrderedUintArray) IndexOf(v uint) int

IndexOf array value

func (NullableOrderedUintArray) Len

func (f NullableOrderedUintArray) Len() int

Len of array

func (NullableOrderedUintArray) OneOf

func (f NullableOrderedUintArray) OneOf(vals []uint) bool

OneOf value in array

func (*NullableOrderedUintArray) Scan

func (f *NullableOrderedUintArray) Scan(value interface{}) (err error)

Scan implements the driver.Valuer interface, []int field

func (NullableOrderedUintArray) Sort

func (f NullableOrderedUintArray) Sort()

Sort ints array

func (*NullableOrderedUintArray) UnmarshalJSON

func (f *NullableOrderedUintArray) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implements the json.Unmarshaller

func (NullableOrderedUintArray) Value

Value implements the driver.Valuer interface, []int field

type NullableStringArray

type NullableStringArray []string

NullableStringArray implementation

func (*NullableStringArray) DecodeValue

func (f *NullableStringArray) DecodeValue(v interface{}) error

DecodeValue implements the gocast.Decoder

func (NullableStringArray) IndexOf

func (f NullableStringArray) IndexOf(v string) int

IndexOf array value

func (NullableStringArray) Join

func (f NullableStringArray) Join(sep string) string

Join array to string

func (NullableStringArray) Len

func (f NullableStringArray) Len() int

Len of array

func (NullableStringArray) MarshalJSON

func (f NullableStringArray) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler

func (NullableStringArray) OneOf

func (f NullableStringArray) OneOf(vals []string) bool

OneOf value in array

func (*NullableStringArray) Scan

func (f *NullableStringArray) Scan(value interface{}) error

Scan implements the driver.Valuer interface, []string field

func (*NullableStringArray) SetArray

func (f *NullableStringArray) SetArray(arr []string) *NullableStringArray

SetArray value

func (*NullableStringArray) UnmarshalJSON

func (f *NullableStringArray) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (NullableStringArray) Value

func (f NullableStringArray) Value() (driver.Value, error)

Value implements the driver.Valuer interface, []string field

type NullableUintArray

type NullableUintArray []uint

NullableUintArray type of field

func (*NullableUintArray) DecodeValue

func (f *NullableUintArray) DecodeValue(v interface{}) error

DecodeValue implements the gocast.Decoder

func (NullableUintArray) Filter

func (f NullableUintArray) Filter(fn func(v uint) (uint, bool)) (resp NullableUintArray)

Filter current array and create filtered copy

func (NullableUintArray) IndexOf

func (f NullableUintArray) IndexOf(v uint) int

IndexOf array value

func (NullableUintArray) Len

func (f NullableUintArray) Len() int

Len of array

func (NullableUintArray) MarshalJSON

func (f NullableUintArray) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler

func (NullableUintArray) OneOf

func (f NullableUintArray) OneOf(vals []uint) bool

OneOf value in array

func (NullableUintArray) Ordered

Ordered object

func (*NullableUintArray) Scan

func (f *NullableUintArray) Scan(value interface{}) error

Scan implements the driver.Valuer interface, []int field

func (NullableUintArray) Sort

func (f NullableUintArray) Sort()

Sort ints array

func (*NullableUintArray) UnmarshalJSON

func (f *NullableUintArray) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (NullableUintArray) Value

func (f NullableUintArray) Value() (driver.Value, error)

Value implements the driver.Valuer interface, []int field

type OrderedIntArray

type OrderedIntArray NullableOrderedIntArray

OrderedIntArray type of field

func (*OrderedIntArray) DecodeValue

func (f *OrderedIntArray) DecodeValue(v interface{}) error

DecodeValue implements the gocast.Decoder

func (OrderedIntArray) Filter

func (f OrderedIntArray) Filter(fn func(v int) (int, bool)) (resp OrderedIntArray)

Filter current array and create filtered copy

func (OrderedIntArray) IndexOf

func (f OrderedIntArray) IndexOf(v int) int

IndexOf array value

func (OrderedIntArray) Len

func (f OrderedIntArray) Len() int

Len of array

func (OrderedIntArray) OneOf

func (f OrderedIntArray) OneOf(vals []int) bool

OneOf value in array

func (*OrderedIntArray) Scan

func (f *OrderedIntArray) Scan(value interface{}) (err error)

Scan implements the driver.Valuer interface, []int field

func (OrderedIntArray) Sort

func (f OrderedIntArray) Sort()

Sort ints array

func (*OrderedIntArray) UnmarshalJSON

func (f *OrderedIntArray) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implements the json.Unmarshaller

func (OrderedIntArray) Value

func (f OrderedIntArray) Value() (driver.Value, error)

Value implements the driver.Valuer interface, []int field

type OrderedUintArray

type OrderedUintArray NullableOrderedUintArray

OrderedUintArray type of field

func (*OrderedUintArray) DecodeValue

func (f *OrderedUintArray) DecodeValue(v interface{}) error

DecodeValue implements the gocast.Decoder

func (OrderedUintArray) Filter

func (f OrderedUintArray) Filter(fn func(v uint) (uint, bool)) (resp OrderedUintArray)

Filter current array and create filtered copy

func (OrderedUintArray) IndexOf

func (f OrderedUintArray) IndexOf(v uint) int

IndexOf array value

func (OrderedUintArray) Len

func (f OrderedUintArray) Len() int

Len of array

func (OrderedUintArray) OneOf

func (f OrderedUintArray) OneOf(vals []uint) bool

OneOf value in array

func (*OrderedUintArray) Scan

func (f *OrderedUintArray) Scan(value interface{}) error

Scan implements the driver.Valuer interface, []int field

func (OrderedUintArray) Sort

func (f OrderedUintArray) Sort()

Sort ints array

func (*OrderedUintArray) UnmarshalJSON

func (f *OrderedUintArray) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implements the json.Unmarshaller

func (OrderedUintArray) Value

func (f OrderedUintArray) Value() (driver.Value, error)

Value implements the driver.Valuer interface, []int field

type StringArray

type StringArray NullableStringArray

StringArray implementation

func (*StringArray) DecodeValue

func (f *StringArray) DecodeValue(v interface{}) error

DecodeValue implements the gocast.Decoder

func (StringArray) IndexOf

func (f StringArray) IndexOf(v string) int

IndexOf array value

func (StringArray) Join

func (f StringArray) Join(sep string) string

Join array to string

func (StringArray) Len

func (f StringArray) Len() int

Len of array

func (StringArray) OneOf

func (f StringArray) OneOf(vals []string) bool

OneOf value in array

func (*StringArray) Scan

func (f *StringArray) Scan(value interface{}) error

Scan implements the driver.Valuer interface, []string field

func (*StringArray) SetArray

func (f *StringArray) SetArray(arr []string) *StringArray

SetArray value

func (*StringArray) UnmarshalJSON

func (f *StringArray) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (StringArray) Value

func (f StringArray) Value() (driver.Value, error)

Value implements the driver.Valuer interface, []string field

type UintArray

type UintArray NullableUintArray

UintArray type of field

func (*UintArray) DecodeValue

func (f *UintArray) DecodeValue(v interface{}) error

DecodeValue implements the gocast.Decoder

func (UintArray) Filter

func (f UintArray) Filter(fn func(v uint) (uint, bool)) (resp UintArray)

Filter current array and create filtered copy

func (UintArray) IndexOf

func (f UintArray) IndexOf(v uint) int

IndexOf array value

func (UintArray) Len

func (f UintArray) Len() int

Len of array

func (UintArray) OneOf

func (f UintArray) OneOf(vals []uint) bool

OneOf value in array

func (UintArray) Ordered

func (f UintArray) Ordered() OrderedUintArray

Ordered object

func (*UintArray) Scan

func (f *UintArray) Scan(value interface{}) error

Scan implements the driver.Valuer interface, []int field

func (UintArray) Sort

func (f UintArray) Sort()

Sort ints array

func (*UintArray) UnmarshalJSON

func (f *UintArray) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller

func (UintArray) Value

func (f UintArray) Value() (driver.Value, error)

Value implements the driver.Valuer interface, []int field

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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