types

package
v0.0.0-...-efe30ab Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package types defines the small value types lakeorm exposes on its public API: SortableID (KSUID-backed), ObjectURI/Location (typed storage addresses), and SparkTableName. Kept in its own package so downstream code can import types without pulling in the driver/format/backend stack.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortableIDsToStrings

func SortableIDsToStrings(ids []SortableID) []string

SortableIDsToStrings converts a slice of SortableID to a slice of strings.

Types

type Location

type Location struct {
	Scheme string // "s3", "gs", "file", "memory"
	Bucket string // bucket/container/root — empty for "file" and "memory"
	Path   string // object key or filesystem path under Bucket
}

Location is a typed storage URI — scheme + bucket + path. It's the coordinate that Client and Driver must agree on at the string level, regardless of whether they resolve to the same physical endpoint via the same credentials. See lakeorm.Verify for the reachability probe that surfaces the mismatch cleanly.

func ParseLocation

func ParseLocation(uri string) (Location, error)

ParseLocation parses a canonical URI ("s3://bucket/key", "gs://bucket/key", "file:///abs/path", "memory://name/key") into a Location.

func (Location) Join

func (l Location) Join(parts ...string) Location

Join returns a new Location with additional path components appended.

func (Location) String

func (l Location) String() string

func (Location) URI

func (l Location) URI() string

URI renders the Location back to its canonical string.

type SortableID

type SortableID string

SortableID is a KSUID stored as its canonical base62 string. KSUIDs sort lexicographically in creation order, which is what makes them suitable for primary keys, idempotency tokens, and ingest IDs on object-storage prefixes (so lexicographic S3 listings match temporal order).

func NewSortableID

func NewSortableID() SortableID

NewSortableID returns a freshly generated KSUID.

func ParseSortableID

func ParseSortableID(s string) (SortableID, error)

ParseSortableID validates and returns a SortableID from a string.

func (SortableID) Bytes

func (id SortableID) Bytes() []byte

Bytes returns the 20 raw KSUID bytes, or nil if the ID is zero.

func (SortableID) Compare

func (id SortableID) Compare(other *SortableID) int

Compare returns -1/0/1 by lexicographic string order (KSUIDs are time-sortable).

func (SortableID) IsNil

func (id SortableID) IsNil() bool

IsNil reports whether the ID is the zero value (empty or ksuid.Nil).

func (SortableID) KSUID

func (id SortableID) KSUID() ksuid.KSUID

KSUID returns the underlying ksuid.KSUID (or ksuid.Nil on error / empty).

func (SortableID) MarshalJSON

func (id SortableID) MarshalJSON() ([]byte, error)

func (SortableID) MarshalText

func (id SortableID) MarshalText() ([]byte, error)

func (*SortableID) Scan

func (id *SortableID) Scan(src any) error

Scan implements sql.Scanner for database/sql. Needed for the reflection scanner in scanner.go to pick SortableID up via its scannerTarget path (nullable SortableID columns become *SortableID fields transparently).

func (SortableID) String

func (id SortableID) String() string

func (*SortableID) UnmarshalJSON

func (id *SortableID) UnmarshalJSON(data []byte) error

func (*SortableID) UnmarshalText

func (id *SortableID) UnmarshalText(text []byte) error

func (SortableID) Value

func (id SortableID) Value() (driver.Value, error)

Value implements driver.Valuer for database/sql.

type SparkTableName

type SparkTableName struct {
	Catalog  string
	Database string
	Table    string
}

SparkTableName is a validated three-part Spark table identifier (catalog.database.table). Catalog is optional; two-part names are normalized to default_catalog.database.table by the Dialect layer.

func ParseSparkTableName

func ParseSparkTableName(s string) (SparkTableName, error)

ParseSparkTableName parses "catalog.database.table", "database.table", or "table". Multi-part names are validated; bare names are returned with empty Catalog/Database for the caller to resolve via defaults.

func (SparkTableName) Qualified

func (n SparkTableName) Qualified(defaultCatalog, defaultDatabase string) string

Qualified returns the full catalog.database.table form, substituting defaults for any empty component. Used by Dialect.PlanQuery when interpolating SQL.

func (SparkTableName) String

func (n SparkTableName) String() string

Jump to

Keyboard shortcuts

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