desc

package
v0.0.0-...-48ad680 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const NAME_VALIDATION_REGEXP = "[A-z0-9_]"
View Source
const ReservedInternalColumnName = "__key"

Variables

View Source
var DebugTables = false

Functions

This section is empty.

Types

type Any

type Any[V any] interface {
	WithID(id uint64)
	ID() uint64
	Key() string
	Name() string
	Equal(o V) bool
}

Any is the interface that all descriptors must implement.

type Column

type Column struct {
	Name     string
	DataType DataType
	Sequence string
}

func InternalKeyColumn

func InternalKeyColumn(seq string) *Column

func NewColumn

func NewColumn(name string, dt DataType) *Column

func NewSequenceColumn

func NewSequenceColumn(name string, seq string) *Column

func SequenceColumn

func SequenceColumn(name string, tokenType scanner.TokenType) (*Column, error)

SequenceColumn is a utility function which turns a name and a scanned token into a desc column.

func (*Column) Equal

func (c *Column) Equal(o *Column) bool

type DataType

type DataType int
const (
	UNKNOWN DataType = iota
	STRING
	NUMBER
	BOOLEAN
)

func GetDataType

func GetDataType(tokenType scanner.TokenType) (DataType, error)

func (DataType) String

func (i DataType) String() string

type Sequence

type Sequence struct {
	SID   uint64 `json:"id"`
	SName string `json:"name"`
	V     uint64 `json:"value"`
}

func NewSequence

func NewSequence(name string) *Sequence

func NewSequenceFromArgs

func NewSequenceFromArgs(id uint64, name string, val uint64) *Sequence

func (*Sequence) Equal

func (s *Sequence) Equal(o *Sequence) bool

Equal returns true if the two sequences are equal.

func (*Sequence) ID

func (s *Sequence) ID() uint64

func (*Sequence) Key

func (t *Sequence) Key() string

Utility functions for the schema table

func (*Sequence) Name

func (s *Sequence) Name() string

func (*Sequence) Next

func (s *Sequence) Next() uint64

Next increments the sequence value and returns the new value.

func (*Sequence) Value

func (t *Sequence) Value() ([]byte, error)

func (*Sequence) WithID

func (s *Sequence) WithID(id uint64)

type Table

type Table struct {
	TID        uint64    `json:"id"`
	TName      string    `json:"name"`
	Columns    []*Column `json:"columns"`
	PrimaryKey []string  `json:"primary_key"`
}

func NewTable

func NewTable(name string, columns []*Column, pkey []string) (*Table, error)

func NewTableFromBytes

func NewTableFromBytes(tableBytes []byte) (*Table, error)

func NewTableWithID

func NewTableWithID(id uint64, name string, columns []*Column, pkey []string) (*Table, error)

func (*Table) DefaultSequenceName

func (t *Table) DefaultSequenceName() string

func (*Table) Equal

func (t *Table) Equal(o *Table) bool

func (*Table) GetColumn

func (t *Table) GetColumn(name string) *Column

func (*Table) GetColumns

func (t *Table) GetColumns() []*Column

func (*Table) ID

func (t *Table) ID() uint64

func (*Table) Key

func (t *Table) Key() string

Utility functions for the desc table

func (*Table) Name

func (t *Table) Name() string

func (*Table) Prefix

func (t *Table) Prefix() *keys.Key

func (*Table) Span

func (t *Table) Span() *keys.Span

func (*Table) Value

func (t *Table) Value() ([]byte, error)

func (*Table) WithID

func (t *Table) WithID(id uint64)

Jump to

Keyboard shortcuts

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