types

package
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: MIT Imports: 18 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")
)
View Source
var GraphQLQueryRules *rules.Rules

Functions

func DataClose added in v0.1.9

func DataClose(data any)

func DuckDBOperationResult

func DuckDBOperationResult() duckdb.TypeInfo

func ExtractResponseData added in v0.1.18

func ExtractResponseData(path string, data map[string]any) any

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 ParseH3Cell added in v0.1.16

func ParseH3Cell(val any) (any, 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)

func WarpGraphQLError added in v0.1.9

func WarpGraphQLError(err error) gqlerror.List

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"`
	AsModule    bool            `json:"as_module"`
	SelfDefined bool            `json:"self_defined"`
	ReadOnly    bool            `json:"read_only"`
	Disabled    bool            `json:"disabled"`
	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 Interval added in v0.1.9

type Interval time.Duration

func (Interval) MarshalJSON added in v0.1.9

func (i Interval) MarshalJSON() ([]byte, error)

func (*Interval) UnmarshalJSON added in v0.1.9

func (i *Interval) UnmarshalJSON(data []byte) error

type OperationResult

type OperationResult struct {
	Succeed bool   `json:"success"`
	Msg     string `json:"message"`
	Rows    int    `json:"affected_rows"`
	LastId  int    `json:"last_id"`
}

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)
	RegisterDataSource(ctx context.Context, ds DataSource) error
	LoadDataSource(ctx context.Context, name string) error
	UnloadDataSource(ctx context.Context, name string) error
	DataSourceStatus(ctx context.Context, name string) (string, error)
	DescribeDataSource(ctx context.Context, name string, self bool) (string, 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 Request added in v0.1.18

type Request struct {
	Query         string                 `json:"query"`
	Variables     map[string]interface{} `json:"variables"`
	OperationName string                 `json:"operationName,omitempty"`
}

type Response

type Response struct {
	Data       map[string]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) Close added in v0.1.9

func (r *Response) Close()

func (*Response) DataPart added in v0.1.18

func (r *Response) DataPart(path string) any

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