eav

package
v0.0.0-...-8fcfbba Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: LGPL-3.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Blob uint8 = iota
	Text
	Int
	Real
)
View Source
const (
	Private uint8 = 0
	Self    uint8 = 1
	Other   uint8 = 2
)

Variables

This section is empty.

Functions

func SerializeOps

func SerializeOps(ops *Operations) ([]byte, error)

Types

type AfterEntityCallback

type AfterEntityCallback func(viewName string, groupID, id ids.ID)

type AfterViewCallback

type AfterViewCallback func(viewName string)

type BeforeEntityCallback

type BeforeEntityCallback func(viewName string, groupID, id ids.ID) error

type BeforeViewCallback

type BeforeViewCallback func(viewName string) error

type ColumnDefinition

type ColumnDefinition struct {
	SourceName   string
	ColumnType   uint8
	DefaultValue *Value // optional default value
	Required     bool   // the value must exist within the eav record
	Nullable     bool   // the value is allowed to be null
}

type EAV

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

func NewEAV

func NewEAV(c *config.Config, d *db.Database, clock clock.Clock, updates chan interface{}) (*EAV, error)

func (*EAV) Apply

func (eav *EAV) Apply(groupID ids.ID, applier uint8, ops *Operations) (*Operations, *Operations, error)

func (*EAV) Backfill

func (eav *EAV) Backfill(groupID ids.ID, authorTag [7]byte, startFrom [16]byte, partial, fromSelf bool) ([]byte, [16]byte, bool, error)

func (*EAV) CreateView

func (eav *EAV) CreateView(viewName string, schema *ViewDefinition) error

func (*EAV) CreateViewWithCounts

func (eav *EAV) CreateViewWithCounts(viewName string, schema *ViewDefinition) (int, int, error)

func (*EAV) Get

func (eav *EAV) Get(dest interface{}, statement string, args ...interface{}) error

Get a single row with a SQL query.

func (*EAV) IndexWhere

func (eav *EAV) IndexWhere(viewName, prefix string) (string, error)

func (*EAV) ProcessBackfill

func (eav *EAV) ProcessBackfill(groupID ids.ID, applier uint8, body []byte) error

func (*EAV) Query

func (eav *EAV) Query(statement string, args ...interface{}) (*Result, error)

Query via SQL.

func (*EAV) Schema

func (eav *EAV) Schema(viewName string) (*ViewDefinition, bool)

func (*EAV) Select

func (eav *EAV) Select(dest interface{}, statement string, args ...interface{}) error

Get a slice of rows with a SQL query.

func (*EAV) Selectors

func (eav *EAV) Selectors(viewName, prefix string, columnNames ...string) (string, error)

func (*EAV) SubscribeAfterEntity

func (eav *EAV) SubscribeAfterEntity(cb AfterEntityCallback, includeBackfill bool, views ...string) error

func (*EAV) SubscribeAfterView

func (eav *EAV) SubscribeAfterView(cb AfterViewCallback, includeBackfill bool, views ...string) error

func (*EAV) SubscribeBeforeEntity

func (eav *EAV) SubscribeBeforeEntity(cb BeforeEntityCallback, includeBackfill bool, views ...string) error

func (*EAV) SubscribeBeforeView

func (eav *EAV) SubscribeBeforeView(cb BeforeViewCallback, includeBackfill bool, views ...string) error

type Operations

type Operations struct {
	Names        []string                               `bencode:"n"`
	OperationMap map[uint64]map[ids.ID]map[uint32]Value `bencode:"m"`
	// contains filtered or unexported fields
}

func DeserializeOps

func DeserializeOps(b []byte) (*Operations, error)

func NewOperations

func NewOperations() *Operations

func (*Operations) Add

func (o *Operations) Add(id ids.ID, ts uint64, name string, val Value) *Operations

func (*Operations) AddBytes

func (o *Operations) AddBytes(id ids.ID, ts uint64, name string, val []byte) *Operations

func (*Operations) AddFloat64

func (o *Operations) AddFloat64(id ids.ID, ts uint64, name string, val float64) *Operations

func (*Operations) AddInt64

func (o *Operations) AddInt64(id ids.ID, ts uint64, name string, val int64) *Operations

func (*Operations) AddMap

func (o *Operations) AddMap(ts uint64, ops map[ids.ID]map[string]Value) *Operations

func (*Operations) AddNil

func (o *Operations) AddNil(id ids.ID, ts uint64, name string) *Operations

func (*Operations) AddString

func (o *Operations) AddString(id ids.ID, ts uint64, name string, val string) *Operations

func (*Operations) Empty

func (o *Operations) Empty() bool

type Result

type Result struct {
	Names []string
	Rows  [][]interface{}
}

type Value

type Value struct {
	NotNull bool   `bencode:"n"`
	Bytes   []byte `bencode:"b"`
}

func NewBoolValue

func NewBoolValue(v bool) *Value

func NewBytesValue

func NewBytesValue(v []byte) *Value

func NewFloat64Value

func NewFloat64Value(v float64) *Value

func NewInt64Value

func NewInt64Value(v int64) *Value

func NewIntValue

func NewIntValue(v int) *Value

func NewStringValue

func NewStringValue(v string) *Value

func NewUint64Value

func NewUint64Value(v uint64) *Value

func NewUintValue

func NewUintValue(v uint) *Value

func NewValue

func NewValue(src interface{}) *Value

func NewValueWithError

func NewValueWithError(src interface{}) (*Value, error)

type ViewDefinition

type ViewDefinition struct {
	Columns map[string]*ColumnDefinition
	Indexes [][]string
}

Jump to

Keyboard shortcuts

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