drivers

package
v0.0.0-...-dfb39b5 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DateLayout = "2006-01-02"
)

Variables

This section is empty.

Functions

func TimeLayout

func TimeLayout(tz bool, precision int) string

func TimestampLayout

func TimestampLayout(tz bool, precision int) string

Types

type BodyMetaPath

type BodyMetaPath struct {
	TotalCount string
}

type Column

type Column interface {
	Name() string
	Attribute() *dal.Attribute
	IsPrimaryKey() bool
	Encode(dal.ValueGetter) (any, error)
	Decode(any, dal.ValueSetter) error
	Type() Type
}

type Dialect

type Dialect interface {
	// TypeWrap returns driver's type implementation for a particular attribute type
	TypeWrap(dal.Type) Type

	MapOpParams(op string) (method string, endpoint string, err error)
	AddSort(req XRequest, field string, desc bool) (XRequest, error)
	AddLimit(req XRequest, limit uint) (XRequest, error)

	EncrichEndpoint(endpoint string, xr XRequest) (out string)

	SearchDataPath() string
	SearchMetaPath() BodyMetaPath

	EncodeBodyInsert(ee ...PayloadEntry) ([]byte, error)
	ExtractInsertMeta(body []byte) (map[string]any, error)
	DecodeBodySelect(body []byte) (map[string]any, error)
}

type GenericTableCodec

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

GenericTableCodec is a generic implementation of TableCodec

func NewTableCodec

func NewTableCodec(m *dal.Model, d Dialect) *GenericTableCodec

func (*GenericTableCodec) AttributeExpression

func (t *GenericTableCodec) AttributeExpression(col string) (out string, err error)

func (*GenericTableCodec) Columns

func (t *GenericTableCodec) Columns() []Column

func (*GenericTableCodec) Decode

func (t *GenericTableCodec) Decode(buf []byte, r dal.ValueSetter) (err error)

func (*GenericTableCodec) Encode

func (t *GenericTableCodec) Encode(r dal.ValueGetter) (_ []byte, err error)

func (*GenericTableCodec) GetColumn

func (t *GenericTableCodec) GetColumn(name string) (c Column, ok bool)

func (*GenericTableCodec) Ident

func (t *GenericTableCodec) Ident() string

type ID

type ID struct {
	ID    uint64
	Valid bool // Valid is true if Uint64 is not NULL
}

nullUint64 represents an uint64 that may be null. nullUint64 implements the Scanner interface so it can be used as a scan dåestination, similar to NullString.

func (*ID) Scan

func (n *ID) Scan(value any) (err error)

Scan implements the Scanner interface.

func (ID) String

func (n ID) String() string

func (ID) Value

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

Value implements the driver Valuer interface.

type Nuances

type Nuances struct {
}

type PayloadEntry

type PayloadEntry struct {
	Path  []string
	Value any
}

type SimpleJsonDocColumn

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

func (*SimpleJsonDocColumn) Attribute

func (c *SimpleJsonDocColumn) Attribute() *dal.Attribute

func (*SimpleJsonDocColumn) Decode

func (c *SimpleJsonDocColumn) Decode(raw any, r dal.ValueSetter) (err error)

func (*SimpleJsonDocColumn) DecodeOld

func (c *SimpleJsonDocColumn) DecodeOld(raw any, r dal.ValueSetter) (err error)

func (*SimpleJsonDocColumn) Encode

func (c *SimpleJsonDocColumn) Encode(r dal.ValueGetter) (_ any, err error)

func (*SimpleJsonDocColumn) IsPrimaryKey

func (c *SimpleJsonDocColumn) IsPrimaryKey() bool

func (*SimpleJsonDocColumn) Name

func (c *SimpleJsonDocColumn) Name() string

func (*SimpleJsonDocColumn) Type

func (c *SimpleJsonDocColumn) Type() Type

type SingleValueColumn

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

func NewSingleValueColumn

func NewSingleValueColumn(d Dialect, a *dal.Attribute) *SingleValueColumn

func (*SingleValueColumn) Attribute

func (c *SingleValueColumn) Attribute() *dal.Attribute

func (*SingleValueColumn) Decode

func (c *SingleValueColumn) Decode(raw any, r dal.ValueSetter) error

func (*SingleValueColumn) Encode

func (c *SingleValueColumn) Encode(r dal.ValueGetter) (any, error)

func (*SingleValueColumn) IsPrimaryKey

func (c *SingleValueColumn) IsPrimaryKey() bool

func (*SingleValueColumn) Name

func (c *SingleValueColumn) Name() string

func (*SingleValueColumn) Type

func (c *SingleValueColumn) Type() Type

type TableCodec

type TableCodec interface {
	Columns() []Column
	Ident() string
	Encode(r dal.ValueGetter) (_ []byte, err error)
	Decode(buf []byte, r dal.ValueSetter) (err error)

	AttributeExpression(col string) (out string, err error)
}

TableCodec is an RDBMS representation of data.Model structure and its arguments

type Type

type Type interface {
	// MakeScanBuffer() any
	Decode(any) (any, bool, error)
	Encode(any) (any, error)
}

func TypeWrap

func TypeWrap(dt dal.Type) Type

TypeWrap wraps type from data package

type TypeBoolean

type TypeBoolean struct{ *dal.TypeBoolean }

func (*TypeBoolean) Decode

func (t *TypeBoolean) Decode(raw any) (any, bool, error)

func (*TypeBoolean) Encode

func (t *TypeBoolean) Encode(val any) (any, error)

type TypeDate

type TypeDate struct{ *dal.TypeDate }

func (*TypeDate) Decode

func (t *TypeDate) Decode(raw any) (any, bool, error)

func (*TypeDate) Encode

func (t *TypeDate) Encode(val any) (any, error)

type TypeEnum

type TypeEnum struct{ *dal.TypeEnum }

func (*TypeEnum) Decode

func (t *TypeEnum) Decode(raw any) (any, bool, error)

func (*TypeEnum) Encode

func (t *TypeEnum) Encode(val any) (any, error)

type TypeGeometry

type TypeGeometry struct{ *dal.TypeGeometry }

func (*TypeGeometry) Decode

func (t *TypeGeometry) Decode(raw any) (any, bool, error)

func (*TypeGeometry) Encode

func (t *TypeGeometry) Encode(val any) (any, error)

type TypeID

type TypeID struct{ *dal.TypeID }

func (*TypeID) Decode

func (t *TypeID) Decode(raw any) (any, bool, error)

func (*TypeID) Encode

func (t *TypeID) Encode(val any) (any, error)

type TypeJSON

type TypeJSON struct{ *dal.TypeJSON }

func (*TypeJSON) Decode

func (t *TypeJSON) Decode(raw any) (any, bool, error)

func (*TypeJSON) Encode

func (t *TypeJSON) Encode(val any) (any, error)

type TypeNumber

type TypeNumber struct{ *dal.TypeNumber }

func (*TypeNumber) Decode

func (t *TypeNumber) Decode(raw any) (any, bool, error)

func (*TypeNumber) Encode

func (t *TypeNumber) Encode(val any) (any, error)

type TypeRef

type TypeRef struct{ *dal.TypeRef }

func (*TypeRef) Decode

func (t *TypeRef) Decode(raw any) (any, bool, error)

func (*TypeRef) Encode

func (t *TypeRef) Encode(val any) (any, error)

type TypeText

type TypeText struct{ *dal.TypeText }

func (*TypeText) Decode

func (t *TypeText) Decode(raw any) (any, bool, error)

func (*TypeText) Encode

func (t *TypeText) Encode(val any) (any, error)

type TypeTime

type TypeTime struct{ *dal.TypeTime }

func (*TypeTime) Decode

func (t *TypeTime) Decode(raw any) (any, bool, error)

func (*TypeTime) Encode

func (t *TypeTime) Encode(val any) (any, error)

type TypeTimestamp

type TypeTimestamp struct{ *dal.TypeTimestamp }

func (*TypeTimestamp) Decode

func (t *TypeTimestamp) Decode(raw any) (any, bool, error)

func (*TypeTimestamp) Encode

func (t *TypeTimestamp) Encode(val any) (any, error)

type XRequest

type XRequest struct {
	Query map[string][]string
}

func (XRequest) EnrichEndpoint

func (r XRequest) EnrichEndpoint(endpoint string) (out string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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