cubecompose

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package cubecompose validates and renders bounded compositions of typed cube queries. Runtime execution and contract derivation remain report-owned.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithFrameContext

func WithFrameContext(ctx context.Context, frame FrameContext) context.Context

Types

type Catalog

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

func NewCatalog

func NewCatalog(fields ...Field) (*Catalog, error)

func (*Catalog) Lookup

func (c *Catalog) Lookup(name string) (Field, bool)

type Column

type Column struct {
	Name string `json:"name"`
	Type string `json:"type"`
	Role Role   `json:"role"`
	// contains filtered or unexported fields
}

func (Column) RuntimeType

func (c Column) RuntimeType() reflect.Type

RuntimeType returns the projected scalar type, or nil for a computed expression.

type Field

type Field struct {
	Name string
	// SQLName is the declared source output. Name may differ only for an
	// explicitly authored mapping established by the report source catalog.
	SQLName string
	Type    reflect.Type
	Role    Role
}

type Frame

type Frame struct {
	SQL  string
	Args []interface{}
}

Frame is one trusted, parameterized cube projection supplied to Render.

type FrameContext

type FrameContext struct {
	Frame     int
	Alignment string
	Snapshot  time.Time
}

FrameContext lets period-aware source predicates interpret elapsed alignment. All frames in a request share Snapshot; Datly does not infer business time rules.

func FrameContextFrom

func FrameContextFrom(ctx context.Context) (FrameContext, bool)

type Plan

type Plan struct {
	Columns    []Column
	Fields     [][]string
	FrameCount int
	Limit      int
	// contains filtered or unexported fields
}

func Compile

func Compile(SQL string, catalog *Catalog, frameCount, maxLimit int) (*Plan, error)

func (*Plan) Render

func (p *Plan) Render(frames []Frame) (string, []interface{}, error)

type Role

type Role string
const (
	Dimension Role = "dimension"
	Measure   Role = "measure"
	Computed  Role = "expression"
)

Jump to

Keyboard shortcuts

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