Help us shape the future of Go! Take the 2026 Go Developer Survey

datatable

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 55 Imported by: 0

Documentation

Overview

Package datatable binds typed report projections to declared client filters, authorization, deterministic pages and bounded CSV/XLSX exports.

Index

Constants

View Source
const (
	MaxRequestBytes = 64 << 10
	MaxColumns      = 128
	MaxFilters      = 128
	MaxFilterDepth  = 8
	MaxFilterValues = 100
	MaxScalarBytes  = 4096
	MaxSorts        = 8
	DefaultPageSize = 20
)

Variables

This section is empty.

Functions

func BindFileExport added in v0.3.0

func BindFileExport[S, R, A, P, Q, B any](table Table[S, R, A], endpoint foundryhttp.Endpoint[P, Q, B, foundryhttp.Download]) foundryhttp.Endpoint[P, Q, B, foundryhttp.Download]

BindFileExport associates a direct file export while preserving its complete typed request, response media types, status and endpoint options.

Example: datatable.BindFileExport(table, endpoint)

func BindTicketExport added in v0.3.0

func BindTicketExport[S, R, A, P, Q, B, T any](table Table[S, R, A], endpoint foundryhttp.Endpoint[P, Q, B, T], request validation.Field[B, Request]) foundryhttp.Endpoint[P, Q, B, T]

BindTicketExport preserves the endpoint's concrete request and ticket response. request explicitly selects a required top-level JSON property containing Request.

Example: datatable.BindTicketExport(table, endpoint, requests.ExportRequestValidationFields().Request)

func ColumnKindCodec added in v0.3.0

func ColumnKindCodec() codec.Codec[ColumnKind]

ColumnKindCodec applies the generated membership rule at both SQL boundaries. Example: ColumnKindCodec()

func DirectionCodec

func DirectionCodec() codec.Codec[Direction]

DirectionCodec applies the generated membership rule at both SQL boundaries. Example: DirectionCodec()

func DownloadEndpoint added in v0.3.0

func DownloadEndpoint[S, R, A, P, Q any](table Table[S, R, A], route foundryhttp.Route[P], query foundryhttp.Query[Q], response foundryhttp.Response[foundryhttp.Download], options ...foundryhttp.EndpointOption) foundryhttp.Endpoint[P, Q, foundryhttp.NoBody, foundryhttp.Download]

DownloadEndpoint declares a bodyless table download with the supplied query and file response. The manifest requires GET and an exportable registered table.

Example: datatable.DownloadEndpoint(table, route, query, http.DownloadResponse("text/csv"))

func DownloadQueryDescriptor added in v0.3.2

func DownloadQueryDescriptor() foundryhttp.Query[DownloadQuery]

DownloadQueryDescriptor binds query parameters to concrete DownloadQuery fields. Reuse this descriptor for request decoding and query URL encoding. Optional fields preserve omission; repeated fields retain slice order.

Example: DownloadQueryDescriptor()

func ExportFormatCodec

func ExportFormatCodec() codec.Codec[ExportFormat]

ExportFormatCodec applies the generated membership rule at both SQL boundaries. Example: ExportFormatCodec()

func ExportHandler

func ExportHandler[P, S, R, A any](table Table[S, R, A], manager *Manager, resolve func(context.Context, P) (A, Request, ExportOptions, error), deliver func(context.Context, P, *Artifact) error) (jobs.Handler[P], error)

ExportHandler adapts a table to an ordinary typed job definition. Resolve reconstructs CURRENT server authority from its persisted payload; it must not trust captured role/permission claims or turn a client model ID into authority. The handler always runs the table's Export authorization and row scope again. Reuse auth.Provider.Resolve for fresh eligibility, then apply current policy.

Deliver receives only a complete artifact, after its database snapshot closes and its generation slot is released. The handler owns and closes it even when delivery fails, panics or Goexits. Its context retains job values and the export's deadline, ends at manager shutdown, and rejects closing the same manager from inside delivery as a cycle. Jobs remain at-least-once: use jobs.Current's execution ID for an idempotent destination. Locale/timezone/actor references belong in P's existing job contract; this adapter creates neither another queue nor implicit email sends.

Example: datatable.ExportHandler(table, manager, resolve, deliver)

func ExportOptionsJSON

func ExportOptionsJSON() foundrycontract.JSON[ExportOptions]

ExportOptionsJSON describes the concrete ExportOptions JSON boundary. Reuse this immutable descriptor for decoding and client contract export. Fields are discovered from Go declarations; persistence models are not response DTOs. Example: ExportOptionsJSON()

func ExportRequestJSON added in v0.3.2

func ExportRequestJSON() foundrycontract.JSON[ExportRequest]

ExportRequestJSON describes the concrete ExportRequest JSON boundary. Reuse this immutable descriptor for decoding and client contract export. Fields are discovered from Go declarations; persistence models are not response DTOs. Example: ExportRequestJSON()

func ExportTicketJSON added in v0.3.2

func ExportTicketJSON() foundrycontract.JSON[ExportTicket]

ExportTicketJSON describes the concrete ExportTicket JSON boundary. Reuse this immutable descriptor for decoding and client contract export. Fields are discovered from Go declarations; persistence models are not response DTOs. Example: ExportTicketJSON()

func FilterJSON

func FilterJSON() foundrycontract.JSON[Filter]

FilterJSON describes the concrete Filter JSON boundary. Reuse this immutable descriptor for decoding and client contract export. Fields are discovered from Go declarations; persistence models are not response DTOs. Example: FilterJSON()

func Module

func Module(name foundation.ProviderID, key foundation.Key[*Manager], requires []foundation.ProviderID, construct func(foundation.Resolver) (*Manager, error)) foundation.Module

Module retains borrowed providers until query and export-generation callbacks actually exit. Completed artifacts use no borrowed provider: shutdown closes any still open instead of waiting for their owners, so the remaining wait is bounded by callbacks honoring cancellation. Export workers must declare this module as their dependency so their deliveries finish first.

Example: datatable.Module(name, key, requires, construct)

func OperatorCodec

func OperatorCodec() codec.Codec[Operator]

OperatorCodec applies the generated membership rule at both SQL boundaries. Example: OperatorCodec()

func PresentationJSON

func PresentationJSON() foundrycontract.JSON[Presentation]

PresentationJSON describes the concrete Presentation JSON boundary. Reuse this immutable descriptor for decoding and client contract export. Fields are discovered from Go declarations; persistence models are not response DTOs. Example: PresentationJSON()

func QueryEndpoint added in v0.3.0

func QueryEndpoint[S, R, A, P, Q any](table Table[S, R, A], route foundryhttp.Route[P], query foundryhttp.Query[Q], options ...foundryhttp.EndpointOption) foundryhttp.Endpoint[P, Q, Request, pagination.NumberedResponse[R]]

QueryEndpoint declares a table query with its request and canonical numbered page contracts. Authentication may use an actor distinct from table authority A.

Example: datatable.QueryEndpoint(table, route, http.EmptyQuery())

func RequestJSON

func RequestJSON() foundrycontract.JSON[Request]

RequestJSON describes the concrete Request JSON boundary. Reuse this immutable descriptor for decoding and client contract export. Fields are discovered from Go declarations; persistence models are not response DTOs. Example: RequestJSON()

func Routes added in v0.3.2

func Routes[S, R, M, A any](group foundryhttp.Scope, table Table[S, R, A], config RoutesConfig[M, A], options ...RouteOption[M]) ([]foundryhttp.RouteRegistration, error)

Routes declares POST /<table ID> for queries and, for exportable tables, POST /<table ID>/export for tickets and GET /<table ID>/download for files. IDs within group end in <table ID>.query, .export and .download. The normal declared status is 200; downloads also support 206 (partial content) and 304 (not modified). Issuance uses CredentialRequests and Quota; downloads resolve the guard through a single-use ticket and enforce ExportAccess.

All declarations are validated before registrations are returned. HTTP owns callback isolation and request lifetime; Manager owns deferred export work.

Example: datatable.Routes(group, table, config, datatable.ReadAccess(read...), datatable.ExportAccess(export...))

func SortJSON

func SortJSON() foundrycontract.JSON[Sort]

SortJSON describes the concrete Sort JSON boundary. Reuse this immutable descriptor for decoding and client contract export. Fields are discovered from Go declarations; persistence models are not response DTOs. Example: SortJSON()

Types

type Action

type Action string

Action identifies the operation passed to a table authorization callback.

Example: datatable.QueryAction

const (
	QueryAction   Action = "query"
	ExportAction  Action = "export"
	InspectAction Action = "inspect"
)

type Artifact

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

Artifact owns one complete private file. Close is mandatory and idempotent; it closes and removes the file and releases its retention slot. Export generation capacity was already released when the file was completed, so a slow download or delivery never blocks other exports from generating. Failed removals remain owned by the manager and block new exports until cleanup succeeds; Close, the next export and manager shutdown retry removal. The path is not public. Manager shutdown closes artifacts that are still open. Reads, seeks and close are serialized; callers must not copy an Artifact.

Example: table.Export(ctx, manager, actor, request, options)

func (*Artifact) Close

func (a *Artifact) Close() error

Close closes and removes the private report, releasing retention capacity after successful removal.

func (*Artifact) EntityTag

func (a *Artifact) EntityTag() foundryhttp.EntityTag

EntityTag is the strong HTTP validator of the exact artifact bytes. Each download regenerates the report, so If-Range/If-None-Match compare content: a range resume against a different run receives the complete new file.

func (*Artifact) MediaType

func (a *Artifact) MediaType() foundryhttp.MediaType

MediaType returns the media type of the completed report.

func (*Artifact) Modified

func (a *Artifact) Modified() time.Time

Modified is the UTC time the artifact was completed.

func (*Artifact) Name

func (a *Artifact) Name() string

Name returns the sanitized download filename.

func (*Artifact) Read

func (a *Artifact) Read(p []byte) (int, error)

Read reads completed report bytes while serializing access with seek and close.

func (*Artifact) Rows

func (a *Artifact) Rows() int

Rows returns the number of exported data rows, excluding the heading.

func (*Artifact) SHA256

func (a *Artifact) SHA256() string

SHA256 returns the hexadecimal digest of the exact report bytes.

func (*Artifact) Seek

func (a *Artifact) Seek(offset int64, whence int) (int64, error)

Seek moves the completed report's read position while the artifact remains open.

func (*Artifact) Size

func (a *Artifact) Size() int64

Size returns the number of completed report bytes.

type Cell

type Cell[V any] struct {
	// contains filtered or unexported fields
}

Cell preserves the exact DTO field type through export formatting. Ordinary scalar cells reuse transport codecs; nullable cells render SQL NULL as empty. The table's JSON graph remains authoritative for public field metadata. XLSX writes scalar integer, float, decimal, boolean, date and date-time cells as typed spreadsheet values when the codec text is exactly representable; FormatWith output is always text.

Example: datatable.ScalarCell(foundryhttp.StringQuery[string]())

func NullableCell

func NullableCell[V any](codec foundryhttp.QueryCodec[V]) Cell[value.Nullable[V]]

NullableCell formats present scalar values with their codec and SQL NULL as empty text.

Example: datatable.NullableCell(codec)

func ScalarCell

func ScalarCell[V any](codec foundryhttp.QueryCodec[V]) Cell[V]

ScalarCell formats an exact scalar field with its declared transport codec.

Example: datatable.ScalarCell(codec)

func (Cell[V]) FormatWith

func (c Cell[V]) FormatWith(format func(context.Context, V, Presentation) (string, error)) Cell[V]

FormatWith explicitly customizes human presentation without replacing the field's JSON or filter contract. It must be concurrency-safe and bounded. Custom presentation is exported as text in every format.

type ColumnInfo

type ColumnInfo struct {
	Name           string                  `json:"name"`
	Label          i18n.MessageKey         `json:"label"`
	Kind           ColumnKind              `json:"kind"`
	Value          contract.ScalarProperty `json:"value"`
	Sortable       bool                    `json:"sortable"`
	Searchable     bool                    `json:"searchable"`
	SearchOperator Operator                `json:"search_operator,omitempty"`
	Exportable     bool                    `json:"exportable"`
	Filter         *FilterInfo             `json:"filter,omitempty"`
}

ColumnInfo describes one declared column for client inspection and export metadata.

Example: datatable.ColumnInfo{Name: "email", Label: "members.email"}

type ColumnKind added in v0.3.0

type ColumnKind string

ColumnKind classifies the data and filter behavior of a datatable column.

Example: datatable.ColumnText

const (
	ColumnText          ColumnKind = "text"
	ColumnInteger       ColumnKind = "integer"
	ColumnDecimal       ColumnKind = "decimal"
	ColumnBoolean       ColumnKind = "boolean"
	ColumnEnum          ColumnKind = "enum"
	ColumnDate          ColumnKind = "date"
	ColumnDateTime      ColumnKind = "date_time"
	ColumnLocalDateTime ColumnKind = "local_date_time"
	ColumnTime          ColumnKind = "time"
)

func ColumnKindValues added in v0.3.0

func ColumnKindValues() []ColumnKind

ColumnKindValues returns declared values in source order, with independent slice ownership. Example: ColumnKindValues()

func ParseColumnKind added in v0.3.0

func ParseColumnKind(text string) (ColumnKind, error)

ParseColumnKind decodes and validates an enum's text representation. Example: ParseColumnKind(text)

func (ColumnKind) EnumDescriptor added in v0.3.0

func (ColumnKind) EnumDescriptor() enum.Descriptor[ColumnKind]

EnumDescriptor describes this enum type independently of the receiver's value.

func (ColumnKind) IsValid added in v0.3.0

func (v ColumnKind) IsValid() bool

IsValid checks membership; a Go cast alone does not validate external values.

func (ColumnKind) MarshalJSON added in v0.3.0

func (v ColumnKind) MarshalJSON() ([]byte, error)

MarshalJSON encodes a validated enum as JSON.

func (ColumnKind) MarshalText added in v0.3.0

func (v ColumnKind) MarshalText() ([]byte, error)

MarshalText encodes a validated enum as text.

func (*ColumnKind) Scan added in v0.3.0

func (v *ColumnKind) Scan(source any) error

Scan changes the receiver only after successful decoding. SQL NULL is rejected.

func (*ColumnKind) UnmarshalJSON added in v0.3.0

func (v *ColumnKind) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes validated JSON and rejects null.

func (*ColumnKind) UnmarshalText added in v0.3.0

func (v *ColumnKind) UnmarshalText(data []byte) error

UnmarshalText decodes validated enum text and changes the receiver only on success.

func (ColumnKind) Validate added in v0.3.0

func (v ColumnKind) Validate() error

Validate reports invalid values without formatting the input.

func (ColumnKind) Value added in v0.3.0

func (v ColumnKind) Value() (driver.Value, error)

Value implements database/sql/driver.Valuer through the shared typed codec.

type ColumnOption added in v0.3.0

type ColumnOption[S, V any] struct {
	// contains filtered or unexported fields
}

ColumnOption preserves the source scope and DTO field type until registration. Construct options with SortBy, FilterBy, Searchable and ExportAs.

Example: datatable.SortBy(expr.AsSelected(name))

func ExportAs added in v0.3.0

func ExportAs[S, V any](_ expr.Selected[S, V], cell Cell[V]) ColumnOption[S, V]

ExportAs binds a cell formatter, inferring scope and value from a selected expression. The expression supplies types only; exports format the DTO field value.

Example: datatable.DefineColumn[UserScope](w.Username, key, datatable.ExportAs(expr.AsSelected(name), datatable.ScalarCell(Text)))

func FilterBy added in v0.3.0

func FilterBy[S, V any](source FilterSource[S, V]) ColumnOption[S, V]

FilterBy binds a filter source for the column.

Example: datatable.DefineColumn[UserScope](w.Username, key, datatable.FilterBy(datatable.Where(Text, expr.TextFilter(name))))

func Searchable added in v0.3.0

func Searchable[S, V any](_ expr.RowValue[S, V]) ColumnOption[S, V]

Searchable marks the column searchable and infers scope and value from its row expression.

Example: datatable.DefineColumn[UserScope](w.Username, key, datatable.Searchable(name))

func SortBy added in v0.3.0

func SortBy[S, V any](expression expr.Selected[S, V]) ColumnOption[S, V]

SortBy binds a selected value of the same scope and DTO field type.

Example: datatable.DefineColumn[UserScope](w.Username, key, datatable.SortBy(expr.AsSelected(name)))

type ColumnRegistration

type ColumnRegistration[S, R any] struct {
	// contains filtered or unexported fields
}

ColumnRegistration erases V only after ownership-safe declaration. Columns from a different source scope or response row cannot be registered together.

Example: datatable.DefineColumn[User](field, "members.email", datatable.SortBy(expr.AsSelected(name)))

func DefineColumn

func DefineColumn[S, R, V any](field validation.Field[R, V], label i18n.MessageKey, options ...ColumnOption[S, V]) ColumnRegistration[S, R]

DefineColumn binds an exact DTO field to typed source options and snapshots its declaration.

Example: datatable.DefineColumn[User](field, label, options...)

type Config

type Config struct {
	// TimeZone is the default export presentation zone. Empty means UTC for a
	// direct manager, or inherits the application timezone during assembly.
	TimeZone     temporal.ZoneName
	Schema       string
	MaxActive    int
	Timeout      time.Duration
	MaxPageSize  int
	MaxOffset    int
	MaxRowBytes  int
	MaxPageBytes int
	// MaxExports bounds concurrent export generation (query, formatting and
	// file writing). A slot is released once the artifact is complete.
	MaxExports int
	// MaxArtifacts bounds completed artifacts still open for delivery, and so
	// the private temporary files held on disk. It is at least MaxExports.
	MaxArtifacts   int
	ExportTimeout  time.Duration
	MaxExportRows  int
	MaxExportBytes int64
	MaxXMLBytes    int64
	MaxCellBytes   int
	TempDir        string
}

Config bounds query, export, artifact retention, and presentation resources.

Example: datatable.DefaultConfig()

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default bounded query and export configuration.

Example: datatable.DefaultConfig()

func (Config) Validate

func (c Config) Validate() error

Validate checks limits, schema, and timezone without acquiring resources.

type Dependencies

type Dependencies struct {
	Database *database.DB
	Locales  i18n.LocaleCatalog
	Labels   Labels
}

Dependencies supplies borrowed database, locale, and label services to a manager.

Example: datatable.Dependencies{Database: db, Locales: locales, Labels: labels}

type Description

type Description struct {
	ID      contract.TableID `json:"id"`
	Row     contract.Schema  `json:"row"`
	Request contract.Schema  `json:"request"`
	// Page derives from the canonical numbered response for Row.
	Page        contract.Schema   `json:"page"`
	Columns     []ColumnInfo      `json:"columns"`
	Filters     []NamedFilterInfo `json:"filters,omitempty"`
	DefaultSort []Sort            `json:"default_sort,omitempty"`
	Exports     bool              `json:"exports"`
}

Description is the table contribution to the shared client manifest. Row and Request schemas originate from their typed contracts. No second TS schema is inferred from SQL, model fields, column names or arbitrary reflection.

Example: table.Description()

func (Description) Normalize

func (d Description) Normalize() (Description, error)

Normalize validates serialized client metadata against its actual row graph. It reuses scalar/filter agreement and sorting rules without constructing SQL expressions, invoking authorization or claiming an executable table binding.

type Direction

type Direction string

Direction selects ascending or descending ordering for a declared column.

Example: datatable.Ascending

const (
	Ascending  Direction = "asc"
	Descending Direction = "desc"
)

func DirectionValues

func DirectionValues() []Direction

DirectionValues returns declared values in source order, with independent slice ownership. Example: DirectionValues()

func ParseDirection

func ParseDirection(text string) (Direction, error)

ParseDirection decodes and validates an enum's text representation. Example: ParseDirection(text)

func (Direction) EnumDescriptor

func (Direction) EnumDescriptor() enum.Descriptor[Direction]

EnumDescriptor describes this enum type independently of the receiver's value.

func (Direction) IsValid

func (v Direction) IsValid() bool

IsValid checks membership; a Go cast alone does not validate external values.

func (Direction) MarshalJSON

func (v Direction) MarshalJSON() ([]byte, error)

MarshalJSON encodes a validated enum as JSON.

func (Direction) MarshalText

func (v Direction) MarshalText() ([]byte, error)

MarshalText encodes a validated enum as text.

func (*Direction) Scan

func (v *Direction) Scan(source any) error

Scan changes the receiver only after successful decoding. SQL NULL is rejected.

func (*Direction) UnmarshalJSON

func (v *Direction) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes validated JSON and rejects null.

func (*Direction) UnmarshalText

func (v *Direction) UnmarshalText(data []byte) error

UnmarshalText decodes validated enum text and changes the receiver only on success.

func (Direction) Validate

func (v Direction) Validate() error

Validate reports invalid values without formatting the input.

func (Direction) Value

func (v Direction) Value() (driver.Value, error)

Value implements database/sql/driver.Valuer through the shared typed codec.

type DownloadQuery added in v0.3.2

type DownloadQuery struct {
	Format  ExportFormat `query:"format"`
	Request string       `query:"request"`
	// Locale preserves the issuing request's language. Omitted values use the
	// download request's negotiated locale.
	Locale value.Optional[i18n.LocaleID] `query:"locale"`
}

DownloadQuery opens a ticket export with its bounded JSON request.

Example: datatable.DownloadQuery{Format: datatable.CSV, Request: "{}"}

type ExportFormat

type ExportFormat string

ExportFormat selects the declared CSV or XLSX report encoding.

Example: datatable.CSV

const (
	CSV  ExportFormat = "csv"
	XLSX ExportFormat = "xlsx"
)

func ExportFormatValues

func ExportFormatValues() []ExportFormat

ExportFormatValues returns declared values in source order, with independent slice ownership. Example: ExportFormatValues()

func ParseExportFormat

func ParseExportFormat(text string) (ExportFormat, error)

ParseExportFormat decodes and validates an enum's text representation. Example: ParseExportFormat(text)

func (ExportFormat) EnumDescriptor

func (ExportFormat) EnumDescriptor() enum.Descriptor[ExportFormat]

EnumDescriptor describes this enum type independently of the receiver's value.

func (ExportFormat) IsValid

func (v ExportFormat) IsValid() bool

IsValid checks membership; a Go cast alone does not validate external values.

func (ExportFormat) MarshalJSON

func (v ExportFormat) MarshalJSON() ([]byte, error)

MarshalJSON encodes a validated enum as JSON.

func (ExportFormat) MarshalText

func (v ExportFormat) MarshalText() ([]byte, error)

MarshalText encodes a validated enum as text.

func (*ExportFormat) Scan

func (v *ExportFormat) Scan(source any) error

Scan changes the receiver only after successful decoding. SQL NULL is rejected.

func (*ExportFormat) UnmarshalJSON

func (v *ExportFormat) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes validated JSON and rejects null.

func (*ExportFormat) UnmarshalText

func (v *ExportFormat) UnmarshalText(data []byte) error

UnmarshalText decodes validated enum text and changes the receiver only on success.

func (ExportFormat) Validate

func (v ExportFormat) Validate() error

Validate reports invalid values without formatting the input.

func (ExportFormat) Value

func (v ExportFormat) Value() (driver.Value, error)

Value implements database/sql/driver.Valuer through the shared typed codec.

type ExportOptions

type ExportOptions struct {
	Format       ExportFormat `json:"format"`
	Name         string       `json:"name,omitempty"`
	Presentation Presentation `json:"presentation"`
	// ByteOrderMark prefixes CSV with a UTF-8 byte-order mark so spreadsheet
	// programs that guess legacy encodings open non-ASCII text correctly. It
	// is rejected for XLSX, whose XML declares its encoding.
	ByteOrderMark bool `json:"byte_order_mark,omitempty"`
}

ExportOptions selects report encoding, filename, and explicit presentation context.

Example: datatable.ExportOptions{Format: datatable.CSV, Name: "members"}

type ExportOptionsValidationFieldSet

type ExportOptionsValidationFieldSet struct {
	// ByteOrderMark validates the declared JSON property "byte_order_mark".
	//
	// ByteOrderMark prefixes CSV with a UTF-8 byte-order mark so spreadsheet
	// programs that guess legacy encodings open non-ASCII text correctly. It
	// is rejected for XLSX, whose XML declares its encoding.
	//
	ByteOrderMark foundryvalidation.Field[ExportOptions, bool]
	// Format validates the declared JSON property "format".
	Format foundryvalidation.Field[ExportOptions, ExportFormat]
	// Name validates the declared JSON property "name".
	Name foundryvalidation.Field[ExportOptions, string]
	// Presentation validates the declared JSON property "presentation".
	Presentation foundryvalidation.Field[ExportOptions, Presentation]
}

ExportOptionsValidationFieldSet retains concrete DTO and value types for validation. Example: ExportOptionsValidationFields()

func ExportOptionsValidationFields

func ExportOptionsValidationFields() ExportOptionsValidationFieldSet

ExportOptionsValidationFields returns typed field descriptors. Example: ExportOptionsValidationFields() Compose rules with these fields; JSON names and selectors are generated.

type ExportRequest added in v0.3.2

type ExportRequest struct {
	Format  ExportFormat `json:"format"`
	Request Request      `json:"request"`
}

ExportRequest asks for every matching row as CSV or XLSX; paging is ignored.

Example: datatable.ExportRequest{Format: datatable.CSV, Request: request}

type ExportRequestValidationFieldSet added in v0.3.2

type ExportRequestValidationFieldSet struct {
	// Format validates the declared JSON property "format".
	Format foundryvalidation.Field[ExportRequest, ExportFormat]
	// Request validates the declared JSON property "request".
	Request foundryvalidation.Field[ExportRequest, Request]
}

ExportRequestValidationFieldSet retains concrete DTO and value types for validation. Example: ExportRequestValidationFields()

func ExportRequestValidationFields added in v0.3.2

func ExportRequestValidationFields() ExportRequestValidationFieldSet

ExportRequestValidationFields returns typed field descriptors. Example: ExportRequestValidationFields() Compose rules with these fields; JSON names and selectors are generated.

type ExportTicket added in v0.3.2

type ExportTicket struct {
	URL       string            `json:"url"`
	ExpiresAt temporal.DateTime `json:"expires_at"`
}

ExportTicket is the download URL and expiry returned by ticket issuance.

Example: datatable.ExportTicket{URL: location, ExpiresAt: expiresAt}

type ExportTicketValidationFieldSet added in v0.3.2

type ExportTicketValidationFieldSet struct {
	// ExpiresAt validates the declared JSON property "expires_at".
	ExpiresAt foundryvalidation.Field[ExportTicket, temporal.DateTime]
	// URL validates the declared JSON property "url".
	URL foundryvalidation.Field[ExportTicket, string]
}

ExportTicketValidationFieldSet retains concrete DTO and value types for validation. Example: ExportTicketValidationFields()

func ExportTicketValidationFields added in v0.3.2

func ExportTicketValidationFields() ExportTicketValidationFieldSet

ExportTicketValidationFields returns typed field descriptors. Example: ExportTicketValidationFields() Compose rules with these fields; JSON names and selectors are generated.

type Filter

type Filter struct {
	Op       Operator `json:"op"`
	Column   string   `json:"column,omitempty"`
	Values   []string `json:"values,omitempty"`
	Children []Filter `json:"children,omitempty"`
}

Filter is either one declared column/operator with scalar text values, or an AND/OR/NOT group with children. Groups cannot carry a column or values. Scalar text is parsed by the column's exact codec; it never becomes a SQL identifier.

Example: datatable.Filter{Column: "email", Op: datatable.Equal, Values: []string{"ada@example.com"}}

type FilterInfo

type FilterInfo struct {
	Phase     FilterPhase               `json:"phase"`
	Scalar    foundryhttp.URLScalarInfo `json:"scalar"`
	Nullable  bool                      `json:"nullable"`
	Operators []Operator                `json:"operators"`
}

FilterInfo describes the exact scalar codec and supported operations. The declaration's owner/value types are erased only for inspection metadata.

Example: source.Description()

type FilterPhase

type FilterPhase string

FilterPhase identifies whether declared predicates apply before or after grouping.

Example: datatable.WherePhase

const (
	WherePhase  FilterPhase = "where"
	HavingPhase FilterPhase = "having"
)

type FilterRegistration

type FilterRegistration[S any] struct {
	// contains filtered or unexported fields
}

FilterRegistration retains a named filter's typed source until table registration.

Example: datatable.DefineFilter("email", "members.email", source)

func DefineFilter

func DefineFilter[S, V any](name string, label i18n.MessageKey, source FilterSource[S, V]) FilterRegistration[S]

DefineFilter declares an extra server filter (for example a related model's name) independently of displayed DTO columns. It shares the strict allowlist.

Example: datatable.DefineFilter(name, label, source)

type FilterSource

type FilterSource[S, V any] struct {
	// contains filtered or unexported fields
}

FilterSource retains both SQL scope and column value, including nullability. Construct with Where/Having or their nullable counterparts. Constructors infer supported comparisons from the supplied typed field/expression. The SQL pattern operator `like` is discovered but disabled until AllowLike.

Example: datatable.Where(foundryhttp.StringQuery[string](), expr.TextFilter(name))

func Having

func Having[S, V any](codec foundryhttp.QueryCodec[V], source GroupEquality[S, V]) FilterSource[S, V]

Having declares a non-null HAVING filter with its typed transport codec and comparison adapter.

Example: datatable.Having(codec, source)

func NullableHaving

func NullableHaving[S, V any](codec foundryhttp.QueryCodec[V], source GroupNullable[S, V]) FilterSource[S, value.Nullable[V]]

NullableHaving declares a nullable HAVING filter whose codec parses present values.

Example: datatable.NullableHaving(codec, source)

func NullableWhere

func NullableWhere[S, V any](codec foundryhttp.QueryCodec[V], source RowNullable[S, V]) FilterSource[S, value.Nullable[V]]

NullableWhere declares a nullable row filter whose codec parses present values.

Example: datatable.NullableWhere(codec, source)

func Related[S, C, V any](source FilterSource[C, V], exists func(expr.Predicate[C]) expr.Predicate[S]) FilterSource[S, V]

Related lifts a declared child filter through a typed relation predicate, such as child.Where(predicate).Exists(). It cannot lift HAVING into a row filter. The callback is server-owned; the table operation owns its isolation/lifetime. The lifted comparison is never unknown, so its negation is NOT EXISTS.

Example: datatable.Related(source, exists)

func Where

func Where[S, V any](codec foundryhttp.QueryCodec[V], source RowEquality[S, V]) FilterSource[S, V]

Where declares a non-null row filter with its typed transport codec and comparison adapter.

Example: datatable.Where(codec, source)

func (FilterSource[S, V]) AllowLike

func (s FilterSource[S, V]) AllowLike() FilterSource[S, V]

AllowLike explicitly enables `like`, whose value is a SQL LIKE pattern: `%` and `_` are wildcards chosen by the client. It is off by default because a client pattern can defeat indexes. `contains`/`icontains` keep literal text.

func (FilterSource[S, V]) Description

func (s FilterSource[S, V]) Description() (FilterInfo, error)

Description returns an owned snapshot of the validated filter metadata.

func (FilterSource[S, V]) Restrict

func (s FilterSource[S, V]) Restrict(operators ...Operator) FilterSource[S, V]

Restrict narrows the enabled comparison allowlist without changing codecs. Call AllowLike first when the restricted set includes `like`.

func (FilterSource[S, V]) Validate

func (s FilterSource[S, V]) Validate() error

Validate reports a missing or invalid filter declaration.

type FilterValidationFieldSet

type FilterValidationFieldSet struct {
	// Children validates the declared JSON property "children".
	Children foundryvalidation.Field[Filter, []Filter]
	// Column validates the declared JSON property "column".
	Column foundryvalidation.Field[Filter, string]
	// Op validates the declared JSON property "op".
	Op foundryvalidation.Field[Filter, Operator]
	// Values validates the declared JSON property "values".
	Values foundryvalidation.Field[Filter, []string]
}

FilterValidationFieldSet retains concrete DTO and value types for validation. Example: FilterValidationFields()

func FilterValidationFields

func FilterValidationFields() FilterValidationFieldSet

FilterValidationFields returns typed field descriptors. Example: FilterValidationFields() Compose rules with these fields; JSON names and selectors are generated.

type GroupEquality

type GroupEquality[S, V any] interface {
	// Eq compares equality within the declared HAVING scope.
	Eq(V) expr.HavingPredicate[S]
	// Ne compares inequality within the declared HAVING scope.
	Ne(V) expr.HavingPredicate[S]
	// In tests membership within the declared HAVING scope.
	In(...V) expr.HavingPredicate[S]
}

GroupEquality requires exact typed equality and membership predicates in HAVING.

Example: expr.OrderValueFilter(expr.Count[User]())

type GroupNullable

type GroupNullable[S, V any] interface {
	GroupEquality[S, V]
	// IsNull tests SQL nullness within the declared HAVING scope.
	IsNull() expr.HavingPredicate[S]
	// IsNotNull tests SQL presence within the declared HAVING scope.
	IsNotNull() expr.HavingPredicate[S]
}

GroupNullable adds SQL null tests to exact typed HAVING comparisons.

Example: expr.NullableOrderValueFilter(expr.Sum(orm.NumberExpr(Orders.Total)))

type Labels

Labels resolves UI message keys for export headings. Catalogs are borrowed; it must be concurrency-safe, honor cancellation and return bounded text.

Example: var labels datatable.Labels = resolveLabel

type Manager

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

Manager owns bounded query/export lifetimes, but borrows its database and locale/label dependencies. Construction performs no I/O and starts no worker. Export generation holds an export slot until its artifact is complete; the artifact then holds only a retention slot and its private file until Close.

Example: datatable.New(dependencies, datatable.DefaultConfig(), table.Registration())

func New

func New(dependencies Dependencies, config Config, registrations ...Registration) (*Manager, error)

New validates dependencies, limits, and table registrations before constructing a manager.

Example: datatable.New(dependencies, config, registrations...)

func (*Manager) Close

func (m *Manager) Close(ctx context.Context) error

Close stops admission, cancels active queries and export generation, and closes every completed artifact that is still open: their readers observe fault.Closed and their private files are removed. Completed artifacts use no borrowed dependency, so shutdown never waits for their owners. The context bounds only the caller's wait for callbacks that are still running.

func (*Manager) DoneExports

func (m *Manager) DoneExports() <-chan struct{}

DoneExports closes after admitted export generation and artifact cleanup have drained.

func (*Manager) DoneQueries

func (m *Manager) DoneQueries() <-chan struct{}

DoneQueries and DoneExports expose actual resource exit separately, without a joining background goroutine. Module shutdown waits for both.

func (*Manager) DownloadTimeout

func (m *Manager) DownloadTimeout() time.Duration

DownloadTimeout reports the download route deadline for this manager's configuration, capped at the HTTP route maximum.

func (*Manager) Registry

func (m *Manager) Registry() *Registry

Registry returns this manager's validated table registry.

func (*Manager) Validate

func (m *Manager) Validate() error

Validate reports initialization, configuration, or registration errors.

type NamedFilterInfo

type NamedFilterInfo struct {
	Name   string          `json:"name"`
	Label  i18n.MessageKey `json:"label"`
	Filter FilterInfo      `json:"filter"`
}

NamedFilterInfo describes one named filter for the shared client manifest.

Example: datatable.NamedFilterInfo{Name: "email", Label: "members.email"}

type Operator

type Operator string

Operator identifies a supported, declared filter operation.

Example: datatable.Equal

const (
	Equal               Operator = "eq"
	NotEqual            Operator = "ne"
	In                  Operator = "in"
	NotIn               Operator = "not_in"
	Less                Operator = "lt"
	LessEqual           Operator = "lte"
	Greater             Operator = "gt"
	GreaterEqual        Operator = "gte"
	Between             Operator = "between"
	Contains            Operator = "contains"
	InsensitiveContains Operator = "icontains"
	Like                Operator = "like"
	IsNull              Operator = "is_null"
	IsNotNull           Operator = "is_not_null"
	All                 Operator = "and"
	Any                 Operator = "or"
	Not                 Operator = "not"
)

func OperatorValues

func OperatorValues() []Operator

OperatorValues returns declared values in source order, with independent slice ownership. Example: OperatorValues()

func ParseOperator

func ParseOperator(text string) (Operator, error)

ParseOperator decodes and validates an enum's text representation. Example: ParseOperator(text)

func (Operator) EnumDescriptor

func (Operator) EnumDescriptor() enum.Descriptor[Operator]

EnumDescriptor describes this enum type independently of the receiver's value.

func (Operator) IsValid

func (v Operator) IsValid() bool

IsValid checks membership; a Go cast alone does not validate external values.

func (Operator) MarshalJSON

func (v Operator) MarshalJSON() ([]byte, error)

MarshalJSON encodes a validated enum as JSON.

func (Operator) MarshalText

func (v Operator) MarshalText() ([]byte, error)

MarshalText encodes a validated enum as text.

func (*Operator) Scan

func (v *Operator) Scan(source any) error

Scan changes the receiver only after successful decoding. SQL NULL is rejected.

func (*Operator) UnmarshalJSON

func (v *Operator) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes validated JSON and rejects null.

func (*Operator) UnmarshalText

func (v *Operator) UnmarshalText(data []byte) error

UnmarshalText decodes validated enum text and changes the receiver only on success.

func (Operator) Validate

func (v Operator) Validate() error

Validate reports invalid values without formatting the input.

func (Operator) Value

func (v Operator) Value() (driver.Value, error)

Value implements database/sql/driver.Valuer through the shared typed codec.

type Presentation

type Presentation struct {
	Locale   i18n.LocaleID `json:"locale"`
	TimeZone string        `json:"time_zone"`
}

Presentation is explicit, serializable export context, suitable for an ordinary typed job payload. It never consults process-global request state.

Example: datatable.Presentation{Locale: "en", TimeZone: "UTC"}

func (Presentation) Location

func (p Presentation) Location() (*time.Location, error)

Location validates and resolves the explicit presentation timezone.

type PresentationValidationFieldSet

type PresentationValidationFieldSet struct {
	// Locale validates the declared JSON property "locale".
	Locale foundryvalidation.Field[Presentation, i18n.LocaleID]
	// TimeZone validates the declared JSON property "time_zone".
	TimeZone foundryvalidation.Field[Presentation, string]
}

PresentationValidationFieldSet retains concrete DTO and value types for validation. Example: PresentationValidationFields()

func PresentationValidationFields

func PresentationValidationFields() PresentationValidationFieldSet

PresentationValidationFields returns typed field descriptors. Example: PresentationValidationFields() Compose rules with these fields; JSON names and selectors are generated.

type Registration

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

Registration retains a table's identity and validation for manager registration.

Example: table.Registration()

type Registry

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

Registry owns the validated set of table registrations indexed by their typed identifiers.

Example: datatable.NewRegistry(table.Registration())

func NewRegistry

func NewRegistry(registrations ...Registration) (*Registry, error)

NewRegistry validates and snapshots table registrations, rejecting duplicate identifiers.

Example: datatable.NewRegistry(registrations...)

func (*Registry) Descriptions

func (r *Registry) Descriptions() ([]Description, error)

Descriptions returns owned table descriptions in stable identifier order.

func (*Registry) Validate

func (r *Registry) Validate() error

Validate reports an uninitialized registry without invoking table callbacks.

type Request

type Request struct {
	Page    int      `json:"page,omitempty"`
	Size    int      `json:"size,omitempty"`
	Sort    []Sort   `json:"sort,omitempty"`
	Filters []Filter `json:"filters,omitempty"`
	Search  string   `json:"search,omitempty"`
}

Request defaults omitted/zero Page and Size to 1 and 20. Everything else is explicit: unknown names, unsupported operators and invalid values are errors. Direct Go callers retain input ownership until the operation returns.

Example: datatable.Request{Page: 1, Size: 20}

func DecodeRequest

func DecodeRequest(ctx context.Context, data []byte) (Request, error)

DecodeRequest rejects unknown/duplicate JSON keys, invalid Unicode, incorrect scalar representations and documents exceeding the shared bounded decoder. Table validation then checks the declaration-specific allowlist before SQL. Rejected input matches http.BadRequest and retains *contract.DecodeError for internal diagnostics. Cancellation and decoder infrastructure faults are not client rejection.

Example: datatable.DecodeRequest(ctx, data)

type RequestValidationFieldSet

type RequestValidationFieldSet struct {
	// Filters validates the declared JSON property "filters".
	Filters foundryvalidation.Field[Request, []Filter]
	// Page validates the declared JSON property "page".
	Page foundryvalidation.Field[Request, int]
	// Search validates the declared JSON property "search".
	Search foundryvalidation.Field[Request, string]
	// Size validates the declared JSON property "size".
	Size foundryvalidation.Field[Request, int]
	// Sort validates the declared JSON property "sort".
	Sort foundryvalidation.Field[Request, []Sort]
}

RequestValidationFieldSet retains concrete DTO and value types for validation. Example: RequestValidationFields()

func RequestValidationFields

func RequestValidationFields() RequestValidationFieldSet

RequestValidationFields returns typed field descriptors. Example: RequestValidationFields() Compose rules with these fields; JSON names and selectors are generated.

type RouteOption added in v0.3.2

type RouteOption[M any] struct {
	// contains filtered or unexported fields
}

RouteOption retains immutable guard options for one table operation. Construct it with ReadAccess or ExportAccess; its zero value is invalid.

Example: datatable.ReadAccess(http.Permissions(readPermission))

func ExportAccess added in v0.3.2

func ExportAccess[M any](options ...foundryhttp.GuardOption[M]) RouteOption[M]

ExportAccess snapshots guard options applied before ticket request decoding. Supplying ExportAccess more than once is an error. These requirements also apply to ticket-authenticated downloads before table authorization.

Example: datatable.ExportAccess(http.Scopes(exportScopes), http.Permissions(exportPermission))

func ReadAccess added in v0.3.2

func ReadAccess[M any](options ...foundryhttp.GuardOption[M]) RouteOption[M]

ReadAccess snapshots guard options applied before query request decoding. Supplying ReadAccess more than once is an error, even with no guard options.

Example: datatable.ReadAccess(http.Scopes(readScopes), http.Permissions(readPermission))

type RoutesConfig added in v0.3.2

type RoutesConfig[M, A any] struct {
	Manager    *Manager
	Guard      foundryhttp.GuardBinding[M]
	Authority  func(context.Context, M) (A, error)
	Tickets    Tickets[M]
	Clock      clock.Clock
	Quota      foundryhttp.Middleware
	WithLocale func(A, i18n.LocaleID) A
}

RoutesConfig supplies borrowed services and typed application authority. Manager, Guard and Authority are required for every table. Exportable tables also require Tickets, Clock and Quota. WithLocale optionally localizes redeemed authority before Download captures it for deferred execution.

Example: datatable.RoutesConfig[Actor, Authority]{Manager: manager, Guard: guard, Authority: authority}

type RowEquality

type RowEquality[S, V any] interface {
	// Eq compares equality within the declared row scope.
	Eq(V) expr.Predicate[S]
	// Ne compares inequality within the declared row scope.
	Ne(V) expr.Predicate[S]
	// In tests membership within the declared row scope.
	In(...V) expr.Predicate[S]
}

RowEquality requires exact typed equality and membership predicates in the row phase.

Example: expr.TextFilter(name)

type RowNullable

type RowNullable[S, V any] interface {
	RowEquality[S, V]
	// IsNull tests SQL nullness within the declared row scope.
	IsNull() expr.Predicate[S]
	// IsNotNull tests SQL presence within the declared row scope.
	IsNotNull() expr.Predicate[S]
}

RowNullable adds SQL null tests to exact typed row comparisons.

Example: expr.NullableTextFilter(nickname)

type Sort

type Sort struct {
	Column    string    `json:"column"`
	Direction Direction `json:"direction"`
}

Sort requests one declared column and ordering direction.

Example: datatable.Sort{Column: "email", Direction: datatable.Ascending}

type SortValidationFieldSet

type SortValidationFieldSet struct {
	// Column validates the declared JSON property "column".
	Column foundryvalidation.Field[Sort, string]
	// Direction validates the declared JSON property "direction".
	Direction foundryvalidation.Field[Sort, Direction]
}

SortValidationFieldSet retains concrete DTO and value types for validation. Example: SortValidationFields()

func SortValidationFields

func SortValidationFields() SortValidationFieldSet

SortValidationFields returns typed field descriptors. Example: SortValidationFields() Compose rules with these fields; JSON names and selectors are generated.

type Spec

type Spec[S, R, A any] struct {
	ID          contract.TableID
	Row         contract.JSON[R]
	Columns     []ColumnRegistration[S, R]
	Filters     []FilterRegistration[S]
	DefaultSort []Sort
	Stable      []expr.ProjectionOrder[S]
	Authorize   func(context.Context, A, Action) error
	Source      func(context.Context, A) (rows.Query[S, R], error)
	Exports     bool
}

Spec binds one row contract to server-owned authorization and row scope. Source must return the complete unpaginated query with mandatory tenant, visibility and soft-delete policy already applied. Authorize is mandatory even for explicitly public/system reports. A is trusted server context, never decoded from Request. Use auth.Guard[M] when binding an authenticated policy. Stable orders must uniquely identify a result (including grouped/joined rows).

Example: var spec datatable.Spec[User, UserRow, Actor]

type Table

type Table[S, R, A any] struct {
	// contains filtered or unexported fields
}

Table retains an immutable, typed table declaration and its authorization policy.

Example: datatable.Define(spec)

func Define

func Define[S, R, A any](spec Spec[S, R, A]) Table[S, R, A]

Define snapshots a typed table specification and retains declaration errors for validation.

Example: datatable.Define(spec)

func (Table[S, R, A]) Count

func (t Table[S, R, A]) Count(ctx context.Context, m *Manager, subject A, request Request) (int64, error)

Count applies the exact Query authorization, server scope and client filters. Request pagination is validated but does not restrict the unpaginated total. The count query omits the table's ordering.

func (Table[S, R, A]) Description

func (t Table[S, R, A]) Description() (Description, error)

Description returns an owned inspection snapshot after validating the declaration.

func (Table[S, R, A]) Download

func (t Table[S, R, A]) Download(ctx context.Context, m *Manager, subject A, request Request, options ExportOptions) (foundryhttp.Download, error)

Download freezes the bounded request, then uses Export when HTTP opens the representation. Every open repeats current authorization and query scoping. The existing HTTP file transport owns range handling and always closes the returned artifact. Subject A must remain valid for that request's lifetime.

Generation and transfer run under the request's single deadline. Declare the download route with WithTimeout(m.DownloadTimeout()) so a report is not cut by the kernel RequestTimeout; generation is also bounded by ExportTimeout. When the request context ends (deadline, client disconnect or shutdown), generation stops and releases its export slot, read transaction and temporary file. Responses carry the artifact's SHA-256 as a strong ETag plus Last-Modified, so a Range resume with If-Range receives the complete new file when a later run differs.

func (Table[S, R, A]) Export

func (t Table[S, R, A]) Export(ctx context.Context, m *Manager, subject A, request Request, options ExportOptions) (result *Artifact, err error)

Export applies the same validated request and server scope as Query. Page and Size are validated, but all matching rows are exported up to MaxExportRows. No artifact is returned until the database stream and complete CSV/ZIP finish. Locale defaults to the configured default; an empty time zone means the configured export zone. A cell that is not valid UTF-8, contains control characters or exceeds its bound is written safely instead of failing.

func (Table[S, R, A]) ID

func (t Table[S, R, A]) ID() contract.TableID

ID returns the declared table identifier, or empty for an undefined table.

func (Table[S, R, A]) Inspect

func (t Table[S, R, A]) Inspect(ctx context.Context, m *Manager, subject A) (Description, error)

Inspect authorizes inspection and returns an owned declaration description.

func (Table[S, R, A]) Query

func (t Table[S, R, A]) Query(ctx context.Context, m *Manager, subject A, request Request) (orm.PageResult[R], error)

Query returns one numbered page and the complete matching total: one count query without the table's ordering and one ordered row query, in a single read-only repeatable-read transaction.

func (Table[S, R, A]) Registration

func (t Table[S, R, A]) Registration() Registration

Registration captures this table's identity for registration with a manager.

func (Table[S, R, A]) SimpleQuery

func (t Table[S, R, A]) SimpleQuery(ctx context.Context, m *Manager, subject A, request Request) (orm.SimplePage[R], error)

SimpleQuery returns one page without counting: the row query reads one lookahead row to report HasMore. Use it for large or expensive sources where a total is not needed. Validation, authorization and scope match Query.

func (Table[S, R, A]) Validate

func (t Table[S, R, A]) Validate() error

Validate reports declaration errors without acquiring query or export resources.

type Tickets added in v0.3.2

type Tickets[M any] struct {
	// contains filtered or unexported fields
}

Tickets retains token-owned issuance and single-use redemption for one actor. Construct it with TokenTickets; its zero value cannot serve export routes.

Example: datatable.TokenTickets(adminTokens)

func TokenTickets added in v0.4.0

func TokenTickets[M model.Identifiable, K any](tokens *token.Tokens[M, K]) Tickets[M]

TokenTickets adapts tokens for table export routes. Routes checks that tickets are enabled and that their credential source matches the route's guard.

Example: datatable.TokenTickets(adminTokens)

Directories

Path Synopsis
Package importer streams CSV and XLSX uploads into typed rows.
Package importer streams CSV and XLSX uploads into typed rows.
internal
exportio
Package exportio owns the standard io.Writer adapters used by datatable export.
Package exportio owns the standard io.Writer adapters used by datatable export.
spreadsheet
Package spreadsheet owns the SpreadsheetML (XLSX) conventions shared by datatable exports and imports: cell references, OOXML text escapes and serial dates.
Package spreadsheet owns the SpreadsheetML (XLSX) conventions shared by datatable exports and imports: cell references, OOXML text escapes and serial dates.

Jump to

Keyboard shortcuts

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