types

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoData        = errors.New("no data")
	ErrWrongDataPath = errors.New("wrong data path")
)

Functions

func DuckDBOperationResult

func DuckDBOperationResult() duckdb.TypeInfo

func GeometryToSQLValue

func GeometryToSQLValue(v any) ([]byte, error)

func IntervalToSQLValue

func IntervalToSQLValue(v any) (string, error)

func ParseGeometryValue

func ParseGeometryValue(v any) (orb.Geometry, error)

func ParseIntervalValue

func ParseIntervalValue(v any) (time.Duration, error)

func ParseJsonValue

func ParseJsonValue(v any) (map[string]interface{}, error)

func ParseRangeValue

func ParseRangeValue(t RangeType, v any) (any, error)

func ParseSQLInterval

func ParseSQLInterval(s string) (time.Duration, error)

func ParseScalarArray

func ParseScalarArray[T ScalarTypes](v any) ([]T, error)

func ParseTimeValue

func ParseTimeValue(v any) (time.Time, error)

func SQLValueToGeometry

func SQLValueToGeometry(v any) (orb.Geometry, error)

Types

type BaseRange

type BaseRange struct {
	Type         RangeType
	Lower, Upper any
	Detail       RangeDetail
}

func (BaseRange) ToInt32Range

func (t BaseRange) ToInt32Range() (Int32Range, error)

func (BaseRange) ToInt64Range

func (t BaseRange) ToInt64Range() (Int64Range, error)

func (BaseRange) ToTimestampRange

func (t BaseRange) ToTimestampRange() (TimeRange, error)

type CatalogSource

type CatalogSource struct {
	Name string            `json:"name"`
	Type CatalogSourceType `json:"type"`
	Path string            `json:"path"`
}

type CatalogSourceType

type CatalogSourceType string

type DataSource

type DataSource struct {
	Name        string          `json:"name"`
	Description string          `json:"description"`
	Type        DataSourceType  `json:"type"`
	Prefix      string          `json:"prefix"`
	Path        string          `json:"path"`
	SelfDefined bool            `json:"self_defined"`
	ReadOnly    bool            `json:"read_only"`
	Sources     []CatalogSource `json:"catalogs"`
}

type DataSourceType

type DataSourceType string

type Int32Range

type Int32Range struct {
	Lower, Upper int32
	Detail       RangeDetail
}

type Int64Range

type Int64Range struct {
	Lower, Upper int64
	Detail       RangeDetail
}

type OperationResult

type OperationResult struct {
	Succeed bool
	Msg     string
	Rows    int
	LastId  int
}

func ErrResult

func ErrResult(err error) *OperationResult

func Result

func Result(msg string, rows, lastId int) *OperationResult

func SQLError

func SQLError(msg string, err error) *OperationResult

func SQLResult

func SQLResult(msg string, res sql.Result) *OperationResult

func (*OperationResult) CollectSQL

func (r *OperationResult) CollectSQL(res sql.Result)

func (*OperationResult) ToDuckdb

func (r *OperationResult) ToDuckdb() map[string]interface{}

type Querier

type Querier interface {
	Query(ctx context.Context, query string, vars map[string]any) (*Response, error)
}

type RangeDetail

type RangeDetail int
const (
	RangeEmpty RangeDetail = 1 << iota
	RangeUpperInfinity
	RangeLowerInfinity
	RangeUpperInclusive
	RangeLowerInclusive
)

func ParseRangeDetail

func ParseRangeDetail(v any) (RangeDetail, error)

func (*RangeDetail) Clear

func (t *RangeDetail) Clear()

func (RangeDetail) IsEmpty

func (t RangeDetail) IsEmpty() bool

func (RangeDetail) IsLowerInclusive

func (t RangeDetail) IsLowerInclusive() bool

func (RangeDetail) IsLowerInfinity

func (t RangeDetail) IsLowerInfinity() bool

func (RangeDetail) IsUpperInclusive

func (t RangeDetail) IsUpperInclusive() bool

func (RangeDetail) IsUpperInfinity

func (t RangeDetail) IsUpperInfinity() bool

type RangeType

type RangeType int
const (
	RangeTypeInt32 RangeType = iota + 1
	RangeTypeInt64
	RangeTypeTimestamp
)

type Response

type Response struct {
	Data       any            `json:"data,omitempty"`
	Extensions map[string]any `json:"extensions,omitempty"`
	Errors     gqlerror.List  `json:"errors,omitempty"`
}

func ErrResponse

func ErrResponse(err error) Response

func (*Response) Err

func (r *Response) Err() error

func (*Response) ScanData

func (r *Response) ScanData(path string, dest interface{}) error

type ScalarTypes

type ScalarTypes interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~float32 | ~float64 | ~string | ~bool | Int32Range | Int64Range | TimeRange | BaseRange | time.Time
}

type TimeRange

type TimeRange struct {
	Lower, Upper time.Time
	Detail       RangeDetail
}

Jump to

Keyboard shortcuts

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