Documentation
¶
Index ¶
- Variables
- func AsBool(v Value) bool
- func AsByteSlice(v Value) []byte
- func AsFloat64(v Value) float64
- func AsInt32(v Value) int32
- func AsInt64(v Value) int64
- func AsString(v Value) string
- func AsTime(v Value) time.Time
- func Desc(dst []byte, n int) ([]byte, int)
- func EncodeValueAsKey(dst []byte, v Value, desc bool) ([]byte, error)
- func EncodeValuesAsKey(dst []byte, values ...Value) ([]byte, error)
- func IsNull(v Value) bool
- func IsTruthy(v Value) (bool, error)
- func ParseTimestamp(s string) (time.Time, error)
- type BigintTypeDef
- type BigintValue
- func (v BigintValue) Add(other Numeric) (Value, error)
- func (v BigintValue) Between(a, b Value) (bool, error)
- func (v BigintValue) BitwiseAnd(other Numeric) (Value, error)
- func (v BigintValue) BitwiseOr(other Numeric) (Value, error)
- func (v BigintValue) BitwiseXor(other Numeric) (Value, error)
- func (v BigintValue) CastAs(target Type) (Value, error)
- func (v BigintValue) Div(other Numeric) (Value, error)
- func (v BigintValue) EQ(other Value) (bool, error)
- func (v BigintValue) Encode(dst []byte) ([]byte, error)
- func (v BigintValue) EncodeAsKey(dst []byte) ([]byte, error)
- func (v BigintValue) GT(other Value) (bool, error)
- func (v BigintValue) GTE(other Value) (bool, error)
- func (v BigintValue) IsZero() (bool, error)
- func (v BigintValue) LT(other Value) (bool, error)
- func (v BigintValue) LTE(other Value) (bool, error)
- func (v BigintValue) MarshalJSON() ([]byte, error)
- func (v BigintValue) MarshalText() ([]byte, error)
- func (v BigintValue) Mod(other Numeric) (Value, error)
- func (v BigintValue) Mul(other Numeric) (Value, error)
- func (v BigintValue) String() string
- func (v BigintValue) Sub(other Numeric) (Value, error)
- func (v BigintValue) Type() Type
- func (v BigintValue) TypeDef() TypeDefinition
- func (v BigintValue) V() any
- type BooleanTypeDef
- type BooleanValue
- func (v BooleanValue) Between(a, b Value) (bool, error)
- func (v BooleanValue) CastAs(target Type) (Value, error)
- func (v BooleanValue) ConvertToIndexedType(t Type) (Value, error)
- func (v BooleanValue) EQ(other Value) (bool, error)
- func (v BooleanValue) Encode(dst []byte) ([]byte, error)
- func (v BooleanValue) EncodeAsKey(dst []byte) ([]byte, error)
- func (v BooleanValue) GT(other Value) (bool, error)
- func (v BooleanValue) GTE(other Value) (bool, error)
- func (v BooleanValue) IsZero() (bool, error)
- func (v BooleanValue) LT(other Value) (bool, error)
- func (v BooleanValue) LTE(other Value) (bool, error)
- func (v BooleanValue) MarshalJSON() ([]byte, error)
- func (v BooleanValue) MarshalText() ([]byte, error)
- func (v BooleanValue) String() string
- func (v BooleanValue) Type() Type
- func (v BooleanValue) TypeDef() TypeDefinition
- func (v BooleanValue) V() any
- type ByteaTypeDef
- type ByteaValue
- func (v ByteaValue) Between(a, b Value) (bool, error)
- func (v ByteaValue) CastAs(target Type) (Value, error)
- func (v ByteaValue) EQ(other Value) (bool, error)
- func (v ByteaValue) Encode(dst []byte) ([]byte, error)
- func (v ByteaValue) EncodeAsKey(dst []byte) ([]byte, error)
- func (v ByteaValue) GT(other Value) (bool, error)
- func (v ByteaValue) GTE(other Value) (bool, error)
- func (v ByteaValue) IsZero() (bool, error)
- func (v ByteaValue) LT(other Value) (bool, error)
- func (v ByteaValue) LTE(other Value) (bool, error)
- func (v ByteaValue) MarshalJSON() ([]byte, error)
- func (v ByteaValue) MarshalText() ([]byte, error)
- func (v ByteaValue) String() string
- func (v ByteaValue) Type() Type
- func (v ByteaValue) TypeDef() TypeDefinition
- func (v ByteaValue) V() any
- type Comparable
- type DoublePrecisionTypeDef
- type DoublePrecisionValue
- func (v DoublePrecisionValue) Add(other Numeric) (Value, error)
- func (v DoublePrecisionValue) Between(a, b Value) (bool, error)
- func (v DoublePrecisionValue) CastAs(target Type) (Value, error)
- func (v DoublePrecisionValue) Div(other Numeric) (Value, error)
- func (v DoublePrecisionValue) EQ(other Value) (bool, error)
- func (v DoublePrecisionValue) Encode(dst []byte) ([]byte, error)
- func (v DoublePrecisionValue) EncodeAsKey(dst []byte) ([]byte, error)
- func (v DoublePrecisionValue) GT(other Value) (bool, error)
- func (v DoublePrecisionValue) GTE(other Value) (bool, error)
- func (v DoublePrecisionValue) IsZero() (bool, error)
- func (v DoublePrecisionValue) LT(other Value) (bool, error)
- func (v DoublePrecisionValue) LTE(other Value) (bool, error)
- func (v DoublePrecisionValue) MarshalJSON() ([]byte, error)
- func (v DoublePrecisionValue) MarshalText() ([]byte, error)
- func (v DoublePrecisionValue) Mod(other Numeric) (Value, error)
- func (v DoublePrecisionValue) Mul(other Numeric) (Value, error)
- func (v DoublePrecisionValue) String() string
- func (v DoublePrecisionValue) Sub(other Numeric) (Value, error)
- func (v DoublePrecisionValue) Type() Type
- func (v DoublePrecisionValue) TypeDef() TypeDefinition
- func (v DoublePrecisionValue) V() any
- type IntegerTypeDef
- type IntegerValue
- func (v IntegerValue) Add(other Numeric) (Value, error)
- func (v IntegerValue) Between(a, b Value) (bool, error)
- func (v IntegerValue) BitwiseAnd(other Numeric) (Value, error)
- func (v IntegerValue) BitwiseOr(other Numeric) (Value, error)
- func (v IntegerValue) BitwiseXor(other Numeric) (Value, error)
- func (v IntegerValue) CastAs(target Type) (Value, error)
- func (v IntegerValue) Div(other Numeric) (Value, error)
- func (v IntegerValue) EQ(other Value) (bool, error)
- func (v IntegerValue) Encode(dst []byte) ([]byte, error)
- func (v IntegerValue) EncodeAsKey(dst []byte) ([]byte, error)
- func (v IntegerValue) GT(other Value) (bool, error)
- func (v IntegerValue) GTE(other Value) (bool, error)
- func (v IntegerValue) IsZero() (bool, error)
- func (v IntegerValue) LT(other Value) (bool, error)
- func (v IntegerValue) LTE(other Value) (bool, error)
- func (v IntegerValue) MarshalJSON() ([]byte, error)
- func (v IntegerValue) MarshalText() ([]byte, error)
- func (v IntegerValue) Mod(other Numeric) (Value, error)
- func (v IntegerValue) Mul(other Numeric) (Value, error)
- func (v IntegerValue) String() string
- func (v IntegerValue) Sub(other Numeric) (Value, error)
- func (v IntegerValue) Type() Type
- func (v IntegerValue) TypeDef() TypeDefinition
- func (v IntegerValue) V() any
- type Integral
- type NullTypeDef
- type NullValue
- func (v NullValue) Between(a, b Value) (bool, error)
- func (v NullValue) CastAs(target Type) (Value, error)
- func (v NullValue) EQ(other Value) (bool, error)
- func (v NullValue) Encode(dst []byte) ([]byte, error)
- func (v NullValue) EncodeAsKey(dst []byte) ([]byte, error)
- func (v NullValue) GT(other Value) (bool, error)
- func (v NullValue) GTE(other Value) (bool, error)
- func (v NullValue) IsZero() (bool, error)
- func (v NullValue) LT(other Value) (bool, error)
- func (v NullValue) LTE(other Value) (bool, error)
- func (v NullValue) MarshalJSON() ([]byte, error)
- func (v NullValue) MarshalText() ([]byte, error)
- func (v NullValue) String() string
- func (v NullValue) Type() Type
- func (v NullValue) TypeDef() TypeDefinition
- func (v NullValue) V() any
- type Numeric
- type TextTypeDef
- type TextValue
- func (v TextValue) Between(a, b Value) (bool, error)
- func (v TextValue) CastAs(target Type) (Value, error)
- func (v TextValue) EQ(other Value) (bool, error)
- func (v TextValue) Encode(dst []byte) ([]byte, error)
- func (v TextValue) EncodeAsKey(dst []byte) ([]byte, error)
- func (v TextValue) GT(other Value) (bool, error)
- func (v TextValue) GTE(other Value) (bool, error)
- func (v TextValue) IsZero() (bool, error)
- func (v TextValue) LT(other Value) (bool, error)
- func (v TextValue) LTE(other Value) (bool, error)
- func (v TextValue) MarshalJSON() ([]byte, error)
- func (v TextValue) MarshalText() ([]byte, error)
- func (v TextValue) String() string
- func (v TextValue) Type() Type
- func (v TextValue) TypeDef() TypeDefinition
- func (v TextValue) V() any
- type TimestampTypeDef
- type TimestampValue
- func (v TimestampValue) Between(a, b Value) (bool, error)
- func (v TimestampValue) CastAs(target Type) (Value, error)
- func (v TimestampValue) EQ(other Value) (bool, error)
- func (v TimestampValue) Encode(dst []byte) ([]byte, error)
- func (v TimestampValue) EncodeAsKey(dst []byte) ([]byte, error)
- func (v TimestampValue) GT(other Value) (bool, error)
- func (v TimestampValue) GTE(other Value) (bool, error)
- func (v TimestampValue) IsZero() (bool, error)
- func (v TimestampValue) LT(other Value) (bool, error)
- func (v TimestampValue) LTE(other Value) (bool, error)
- func (v TimestampValue) MarshalJSON() ([]byte, error)
- func (v TimestampValue) MarshalText() ([]byte, error)
- func (v TimestampValue) String() string
- func (v TimestampValue) Type() Type
- func (v TimestampValue) TypeDef() TypeDefinition
- func (v TimestampValue) V() any
- type Type
- func (t Type) Def() TypeDefinition
- func (t Type) IsAny() bool
- func (t Type) IsComparableWith(other Type) bool
- func (t Type) IsInteger() bool
- func (t Type) IsNumber() bool
- func (t Type) IsTimestampCompatible() bool
- func (t Type) MaxEnctype() byte
- func (t Type) MaxEnctypeDesc() byte
- func (t Type) MinEnctype() byte
- func (t Type) MinEnctypeDesc() byte
- func (t Type) String() string
- type TypeDefinition
- type Value
- type ValueScanner
Constants ¶
This section is empty.
Variables ¶
var ( // ErrColumnNotFound must be returned by row implementations, when calling the Get method and // the column doesn't exist. ErrColumnNotFound = errors.New("column not found") )
Functions ¶
func AsByteSlice ¶ added in v0.17.0
func Desc ¶ added in v0.17.0
Desc changes the type of the encoded value to its descending counterpart. It is meant to be used in combination with one of the Encode* functions.
var buf []byte buf, n = encoding.Desc(encoding.EncodeInt(buf, 10))
func EncodeValueAsKey ¶ added in v0.17.0
func EncodeValuesAsKey ¶ added in v0.17.0
Types ¶
type BigintTypeDef ¶ added in v0.17.0
type BigintTypeDef struct{}
func (BigintTypeDef) IsComparableWith ¶ added in v0.17.0
func (BigintTypeDef) IsComparableWith(other Type) bool
func (BigintTypeDef) IsIndexComparableWith ¶ added in v0.17.0
func (BigintTypeDef) IsIndexComparableWith(other Type) bool
type BigintValue ¶ added in v0.17.0
type BigintValue int64
func NewBigintValue ¶ added in v0.17.0
func NewBigintValue(x int64) BigintValue
NewBigintValue returns a SQL BIGINT value.
func (BigintValue) Between ¶ added in v0.17.0
func (v BigintValue) Between(a, b Value) (bool, error)
func (BigintValue) BitwiseAnd ¶ added in v0.17.0
func (v BigintValue) BitwiseAnd(other Numeric) (Value, error)
func (BigintValue) BitwiseOr ¶ added in v0.17.0
func (v BigintValue) BitwiseOr(other Numeric) (Value, error)
func (BigintValue) BitwiseXor ¶ added in v0.17.0
func (v BigintValue) BitwiseXor(other Numeric) (Value, error)
func (BigintValue) CastAs ¶ added in v0.17.0
func (v BigintValue) CastAs(target Type) (Value, error)
func (BigintValue) Encode ¶ added in v0.17.0
func (v BigintValue) Encode(dst []byte) ([]byte, error)
func (BigintValue) EncodeAsKey ¶ added in v0.17.0
func (v BigintValue) EncodeAsKey(dst []byte) ([]byte, error)
func (BigintValue) IsZero ¶ added in v0.17.0
func (v BigintValue) IsZero() (bool, error)
func (BigintValue) MarshalJSON ¶ added in v0.17.0
func (v BigintValue) MarshalJSON() ([]byte, error)
func (BigintValue) MarshalText ¶ added in v0.17.0
func (v BigintValue) MarshalText() ([]byte, error)
func (BigintValue) String ¶ added in v0.17.0
func (v BigintValue) String() string
func (BigintValue) Type ¶ added in v0.17.0
func (v BigintValue) Type() Type
func (BigintValue) TypeDef ¶ added in v0.17.0
func (v BigintValue) TypeDef() TypeDefinition
func (BigintValue) V ¶ added in v0.17.0
func (v BigintValue) V() any
type BooleanTypeDef ¶ added in v0.17.0
type BooleanTypeDef struct{}
func (BooleanTypeDef) Decode ¶ added in v0.17.0
func (t BooleanTypeDef) Decode(src []byte) (Value, int)
func (BooleanTypeDef) IsComparableWith ¶ added in v0.17.0
func (BooleanTypeDef) IsComparableWith(other Type) bool
func (BooleanTypeDef) IsIndexComparableWith ¶ added in v0.17.0
func (BooleanTypeDef) IsIndexComparableWith(other Type) bool
type BooleanValue ¶
type BooleanValue bool
func NewBooleanValue ¶ added in v0.17.0
func NewBooleanValue(x bool) BooleanValue
NewBooleanValue returns a SQL BOOLEAN value.
func (BooleanValue) Between ¶ added in v0.17.0
func (v BooleanValue) Between(a, b Value) (bool, error)
func (BooleanValue) CastAs ¶ added in v0.17.0
func (v BooleanValue) CastAs(target Type) (Value, error)
func (BooleanValue) ConvertToIndexedType ¶ added in v0.17.0
func (v BooleanValue) ConvertToIndexedType(t Type) (Value, error)
func (BooleanValue) Encode ¶ added in v0.17.0
func (v BooleanValue) Encode(dst []byte) ([]byte, error)
func (BooleanValue) EncodeAsKey ¶ added in v0.17.0
func (v BooleanValue) EncodeAsKey(dst []byte) ([]byte, error)
func (BooleanValue) IsZero ¶ added in v0.17.0
func (v BooleanValue) IsZero() (bool, error)
func (BooleanValue) MarshalJSON ¶ added in v0.17.0
func (v BooleanValue) MarshalJSON() ([]byte, error)
func (BooleanValue) MarshalText ¶ added in v0.17.0
func (v BooleanValue) MarshalText() ([]byte, error)
func (BooleanValue) String ¶ added in v0.17.0
func (v BooleanValue) String() string
func (BooleanValue) Type ¶ added in v0.17.0
func (v BooleanValue) Type() Type
func (BooleanValue) TypeDef ¶ added in v0.17.0
func (v BooleanValue) TypeDef() TypeDefinition
func (BooleanValue) V ¶ added in v0.17.0
func (v BooleanValue) V() any
type ByteaTypeDef ¶ added in v0.18.0
type ByteaTypeDef struct{}
func (ByteaTypeDef) IsComparableWith ¶ added in v0.18.0
func (ByteaTypeDef) IsComparableWith(other Type) bool
func (ByteaTypeDef) IsIndexComparableWith ¶ added in v0.18.0
func (ByteaTypeDef) IsIndexComparableWith(other Type) bool
type ByteaValue ¶ added in v0.18.0
type ByteaValue []byte
func NewByteaValue ¶ added in v0.18.0
func NewByteaValue(x []byte) ByteaValue
NewByteaValue returns a SQL BYTEA value.
func (ByteaValue) EncodeAsKey ¶ added in v0.18.0
func (v ByteaValue) EncodeAsKey(dst []byte) ([]byte, error)
func (ByteaValue) IsZero ¶ added in v0.18.0
func (v ByteaValue) IsZero() (bool, error)
func (ByteaValue) MarshalJSON ¶ added in v0.18.0
func (v ByteaValue) MarshalJSON() ([]byte, error)
func (ByteaValue) MarshalText ¶ added in v0.18.0
func (v ByteaValue) MarshalText() ([]byte, error)
func (ByteaValue) String ¶ added in v0.18.0
func (v ByteaValue) String() string
func (ByteaValue) Type ¶ added in v0.18.0
func (v ByteaValue) Type() Type
func (ByteaValue) TypeDef ¶ added in v0.18.0
func (v ByteaValue) TypeDef() TypeDefinition
func (ByteaValue) V ¶ added in v0.18.0
func (v ByteaValue) V() any
type Comparable ¶ added in v0.17.0
type DoublePrecisionTypeDef ¶ added in v0.18.0
type DoublePrecisionTypeDef struct{}
func (DoublePrecisionTypeDef) Decode ¶ added in v0.18.0
func (DoublePrecisionTypeDef) Decode(src []byte) (Value, int)
func (DoublePrecisionTypeDef) IsComparableWith ¶ added in v0.18.0
func (DoublePrecisionTypeDef) IsComparableWith(other Type) bool
func (DoublePrecisionTypeDef) IsIndexComparableWith ¶ added in v0.18.0
func (DoublePrecisionTypeDef) IsIndexComparableWith(other Type) bool
type DoublePrecisionValue ¶ added in v0.18.0
type DoublePrecisionValue float64
func NewDoublePrecisionValue ¶ added in v0.18.0
func NewDoublePrecisionValue(x float64) DoublePrecisionValue
NewDoublePrecisionValue returns a SQL DOUBLE PRECISION value.
func (DoublePrecisionValue) Add ¶ added in v0.18.0
func (v DoublePrecisionValue) Add(other Numeric) (Value, error)
func (DoublePrecisionValue) Between ¶ added in v0.18.0
func (v DoublePrecisionValue) Between(a, b Value) (bool, error)
func (DoublePrecisionValue) CastAs ¶ added in v0.18.0
func (v DoublePrecisionValue) CastAs(target Type) (Value, error)
func (DoublePrecisionValue) Div ¶ added in v0.18.0
func (v DoublePrecisionValue) Div(other Numeric) (Value, error)
func (DoublePrecisionValue) EQ ¶ added in v0.18.0
func (v DoublePrecisionValue) EQ(other Value) (bool, error)
func (DoublePrecisionValue) Encode ¶ added in v0.18.0
func (v DoublePrecisionValue) Encode(dst []byte) ([]byte, error)
func (DoublePrecisionValue) EncodeAsKey ¶ added in v0.18.0
func (v DoublePrecisionValue) EncodeAsKey(dst []byte) ([]byte, error)
func (DoublePrecisionValue) GT ¶ added in v0.18.0
func (v DoublePrecisionValue) GT(other Value) (bool, error)
func (DoublePrecisionValue) GTE ¶ added in v0.18.0
func (v DoublePrecisionValue) GTE(other Value) (bool, error)
func (DoublePrecisionValue) IsZero ¶ added in v0.18.0
func (v DoublePrecisionValue) IsZero() (bool, error)
func (DoublePrecisionValue) LT ¶ added in v0.18.0
func (v DoublePrecisionValue) LT(other Value) (bool, error)
func (DoublePrecisionValue) LTE ¶ added in v0.18.0
func (v DoublePrecisionValue) LTE(other Value) (bool, error)
func (DoublePrecisionValue) MarshalJSON ¶ added in v0.18.0
func (v DoublePrecisionValue) MarshalJSON() ([]byte, error)
func (DoublePrecisionValue) MarshalText ¶ added in v0.18.0
func (v DoublePrecisionValue) MarshalText() ([]byte, error)
func (DoublePrecisionValue) Mod ¶ added in v0.18.0
func (v DoublePrecisionValue) Mod(other Numeric) (Value, error)
func (DoublePrecisionValue) Mul ¶ added in v0.18.0
func (v DoublePrecisionValue) Mul(other Numeric) (Value, error)
func (DoublePrecisionValue) String ¶ added in v0.18.0
func (v DoublePrecisionValue) String() string
func (DoublePrecisionValue) Sub ¶ added in v0.18.0
func (v DoublePrecisionValue) Sub(other Numeric) (Value, error)
func (DoublePrecisionValue) Type ¶ added in v0.18.0
func (v DoublePrecisionValue) Type() Type
func (DoublePrecisionValue) TypeDef ¶ added in v0.18.0
func (v DoublePrecisionValue) TypeDef() TypeDefinition
func (DoublePrecisionValue) V ¶ added in v0.18.0
func (v DoublePrecisionValue) V() any
type IntegerTypeDef ¶ added in v0.17.0
type IntegerTypeDef struct{}
func (IntegerTypeDef) Decode ¶ added in v0.17.0
func (IntegerTypeDef) Decode(src []byte) (Value, int)
func (IntegerTypeDef) IsComparableWith ¶ added in v0.17.0
func (IntegerTypeDef) IsComparableWith(other Type) bool
func (IntegerTypeDef) IsIndexComparableWith ¶ added in v0.17.0
func (IntegerTypeDef) IsIndexComparableWith(other Type) bool
type IntegerValue ¶
type IntegerValue int32
func NewIntegerValue ¶
func NewIntegerValue(x int32) IntegerValue
NewIntegerValue returns a SQL INTEGER value.
func (IntegerValue) Between ¶ added in v0.17.0
func (v IntegerValue) Between(a, b Value) (bool, error)
func (IntegerValue) BitwiseAnd ¶ added in v0.17.0
func (v IntegerValue) BitwiseAnd(other Numeric) (Value, error)
func (IntegerValue) BitwiseOr ¶ added in v0.17.0
func (v IntegerValue) BitwiseOr(other Numeric) (Value, error)
func (IntegerValue) BitwiseXor ¶ added in v0.17.0
func (v IntegerValue) BitwiseXor(other Numeric) (Value, error)
func (IntegerValue) CastAs ¶ added in v0.17.0
func (v IntegerValue) CastAs(target Type) (Value, error)
func (IntegerValue) Encode ¶ added in v0.17.0
func (v IntegerValue) Encode(dst []byte) ([]byte, error)
func (IntegerValue) EncodeAsKey ¶ added in v0.17.0
func (v IntegerValue) EncodeAsKey(dst []byte) ([]byte, error)
func (IntegerValue) IsZero ¶ added in v0.17.0
func (v IntegerValue) IsZero() (bool, error)
func (IntegerValue) MarshalJSON ¶ added in v0.17.0
func (v IntegerValue) MarshalJSON() ([]byte, error)
func (IntegerValue) MarshalText ¶ added in v0.17.0
func (v IntegerValue) MarshalText() ([]byte, error)
func (IntegerValue) String ¶ added in v0.17.0
func (v IntegerValue) String() string
func (IntegerValue) Type ¶ added in v0.17.0
func (v IntegerValue) Type() Type
func (IntegerValue) TypeDef ¶ added in v0.17.0
func (v IntegerValue) TypeDef() TypeDefinition
func (IntegerValue) V ¶ added in v0.17.0
func (v IntegerValue) V() any
type Integral ¶ added in v0.17.0
type Integral interface {
// BitwiseAnd calculates v & u and returns the result.
// Only numeric values and booleans can be calculated together.
// If both v and u are integers, the result will be an integer.
BitwiseAnd(other Numeric) (Value, error)
// BitwiseOr calculates v | u and returns the result.
// Only numeric values and booleans can be calculated together.
// If both v and u are integers, the result will be an integer.
BitwiseOr(other Numeric) (Value, error)
// BitwiseXor calculates v ^ u and returns the result.
// Only numeric values and booleans can be calculated together.
// If both v and u are integers, the result will be an integer.
BitwiseXor(other Numeric) (Value, error)
}
type NullTypeDef ¶ added in v0.17.0
type NullTypeDef struct{}
func (NullTypeDef) IsComparableWith ¶ added in v0.17.0
func (NullTypeDef) IsComparableWith(other Type) bool
func (NullTypeDef) IsIndexComparableWith ¶ added in v0.17.0
func (NullTypeDef) IsIndexComparableWith(other Type) bool
type NullValue ¶
type NullValue struct{}
func (NullValue) EncodeAsKey ¶ added in v0.17.0
func (NullValue) MarshalJSON ¶ added in v0.17.0
func (NullValue) MarshalText ¶ added in v0.17.0
func (NullValue) TypeDef ¶ added in v0.17.0
func (v NullValue) TypeDef() TypeDefinition
type Numeric ¶ added in v0.17.0
type Numeric interface {
Value
// Add u to v and return the result.
// Only numeric values and booleans can be added together.
Add(other Numeric) (Value, error)
// Sub calculates v - u and returns the result.
// Only numeric values and booleans can be calculated together.
Sub(other Numeric) (Value, error)
// Mul calculates v * u and returns the result.
// Only numeric values and booleans can be calculated together.
Mul(other Numeric) (Value, error)
// Div calculates v / u and returns the result.
// Only numeric values and booleans can be calculated together.
// If both v and u are integers, the result will be an integer.
Div(other Numeric) (Value, error)
// Mod calculates v / u and returns the result.
// Only numeric values and booleans can be calculated together.
// If both v and u are integers, the result will be an integer.
Mod(other Numeric) (Value, error)
}
type TextTypeDef ¶ added in v0.17.0
type TextTypeDef struct{}
func (TextTypeDef) IsComparableWith ¶ added in v0.17.0
func (TextTypeDef) IsComparableWith(other Type) bool
func (TextTypeDef) IsIndexComparableWith ¶ added in v0.17.0
func (t TextTypeDef) IsIndexComparableWith(other Type) bool
type TextValue ¶
type TextValue string
func (TextValue) EncodeAsKey ¶ added in v0.17.0
func (TextValue) MarshalJSON ¶ added in v0.17.0
func (TextValue) MarshalText ¶ added in v0.17.0
func (TextValue) TypeDef ¶ added in v0.17.0
func (v TextValue) TypeDef() TypeDefinition
type TimestampTypeDef ¶ added in v0.17.0
type TimestampTypeDef struct{}
func (TimestampTypeDef) Decode ¶ added in v0.17.0
func (t TimestampTypeDef) Decode(src []byte) (Value, int)
func (TimestampTypeDef) IsComparableWith ¶ added in v0.17.0
func (TimestampTypeDef) IsComparableWith(other Type) bool
func (TimestampTypeDef) IsIndexComparableWith ¶ added in v0.17.0
func (TimestampTypeDef) IsIndexComparableWith(other Type) bool
type TimestampValue ¶
func NewTimestampValue ¶
func NewTimestampValue(x time.Time) TimestampValue
NewTimestampValue returns a SQL TIMESTAMP value.
func (TimestampValue) Between ¶ added in v0.17.0
func (v TimestampValue) Between(a, b Value) (bool, error)
func (TimestampValue) CastAs ¶ added in v0.17.0
func (v TimestampValue) CastAs(target Type) (Value, error)
func (TimestampValue) Encode ¶ added in v0.17.0
func (v TimestampValue) Encode(dst []byte) ([]byte, error)
func (TimestampValue) EncodeAsKey ¶ added in v0.17.0
func (v TimestampValue) EncodeAsKey(dst []byte) ([]byte, error)
func (TimestampValue) IsZero ¶ added in v0.17.0
func (v TimestampValue) IsZero() (bool, error)
func (TimestampValue) MarshalJSON ¶ added in v0.17.0
func (v TimestampValue) MarshalJSON() ([]byte, error)
func (TimestampValue) MarshalText ¶ added in v0.17.0
func (v TimestampValue) MarshalText() ([]byte, error)
func (TimestampValue) String ¶ added in v0.17.0
func (v TimestampValue) String() string
func (TimestampValue) Type ¶ added in v0.17.0
func (v TimestampValue) Type() Type
func (TimestampValue) TypeDef ¶ added in v0.17.0
func (v TimestampValue) TypeDef() TypeDefinition
func (TimestampValue) V ¶ added in v0.17.0
func (v TimestampValue) V() any
type Type ¶ added in v0.17.0
type Type uint8
Type represents a type supported by the database.
const ( // TypeAny denotes the absence of type TypeAny Type = iota TypeNull TypeBoolean TypeInteger TypeBigint TypeDoublePrecision TypeTimestamp TypeText TypeBytea )
List of supported types.
func (Type) Def ¶ added in v0.17.0
func (t Type) Def() TypeDefinition
func (Type) IsComparableWith ¶ added in v0.17.0
func (Type) IsTimestampCompatible ¶ added in v0.17.0
IsTimestampCompatible returns true if t is either a timestamp, an integer, or a text.
func (Type) MaxEnctype ¶ added in v0.17.0
func (Type) MaxEnctypeDesc ¶ added in v0.17.0
func (Type) MinEnctype ¶ added in v0.17.0
func (Type) MinEnctypeDesc ¶ added in v0.17.0
type TypeDefinition ¶ added in v0.17.0
type Value ¶
type Value interface {
Comparable
Type() Type
V() any
IsZero() (bool, error)
String() string
MarshalJSON() ([]byte, error)
MarshalText() ([]byte, error)
TypeDef() TypeDefinition
Encode(dst []byte) ([]byte, error)
EncodeAsKey(dst []byte) ([]byte, error)
CastAs(t Type) (Value, error)
}
func DecodeValue ¶ added in v0.17.0
func DecodeValues ¶ added in v0.17.0
type ValueScanner ¶ added in v0.17.0
type ValueScanner struct {
V Value
}
ValueScanner implements the sql.Scanner interface for Value. The src value will be of one of the following types:
int32 int64 float64 bool []byte string time.Time nil - for NULL values
func (*ValueScanner) Scan ¶ added in v0.17.0
func (v *ValueScanner) Scan(src any) error