collection

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: LGPL-2.1 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ASC = iota
	DESC
)
View Source
const MaxInt = int(MaxUint >> 1)
View Source
const MaxUint = ^uint64(0)
View Source
const MinInt = -MaxInt - 1
View Source
const MinUint = 0
View Source
const NO_LIMIT = -1

Variables

This section is empty.

Functions

This section is empty.

Types

type CId

type CId uint64

Collection ID

func (CId) ValidP

func (c CId) ValidP() bool

Checks, if CId is valid.

Returns:

  • True, if CId is valid, false otherwise.

type CIdSet

type CIdSet map[CId]bool

func CIdSetFromSlice

func CIdSetFromSlice(s []CId) CIdSet

Creates a CId set from the CId slice.

Parameters:

  • s - CId slice.

Returns:

  • New CId set.

func (CIdSet) Intersect

func (ego CIdSet) Intersect(s CIdSet) CIdSet

Makes the intersection of two CId sets.

Parameters:

  • s - One of the CId sets.

Returns:

  • Newly created CId set by intersection.

func (CIdSet) Merge

func (ego CIdSet) Merge(s CIdSet)

Merges two CId sets.

Parameters:

  • s - Set to be merged.

func (CIdSet) ToSlice

func (ego CIdSet) ToSlice() []CId

Creates a CId slice from the CId set.

Returns:

  • New CId slice.

type Collection

type Collection interface {
	gonatus.Gobjecter
	Filter(FilterArgument) (stream.Producer[RecordConf], error)
	// Group(QueryConf, GroupQueryConf) (streams.ReadableOutputStreamer[GroupRecordConf], error) // TODO: define grouping
	AddRecord(RecordConf) (CId, error)
	DeleteRecord(RecordConf) error
	DeleteByFilter(FilterArgument) error
	EditRecord(RecordConf) error
	Commit() error
}

type FieldConf

type FieldConf[T any] struct {
	FielderConf
	Value T
}

type FieldType

type FieldType uint64

type FielderConf

type FielderConf interface {
}

type FilterArgument

type FilterArgument struct {
	QueryConf
	Sort      []string
	SortOrder int
	Skip      int
	Limit     int
}

type FullmatchIndexConf

type FullmatchIndexConf[T any] struct {
	IndexerConf
	Name string
}

type IndexerConf

type IndexerConf interface {
}

Just registers Indexer

type PrefixIndexConf

type PrefixIndexConf[T any] struct {
	IndexerConf
	Name      string
	MinPrefix uint
}

type QueryAndConf

type QueryAndConf struct {
	QueryContextConf
}

type QueryAtomConf

type QueryAtomConf struct {
	QueryConf
	MatchType IndexerConf
	Name      string
	Value     any // TODO: Use generic here?
}

type QueryConf

type QueryConf interface {
}

type QueryContextConf

type QueryContextConf struct {
	QueryConf
	Context []QueryConf
}

type QueryImplicationConf

type QueryImplicationConf struct {
	QueryConf
	Left  QueryAtomConf
	Right QueryAtomConf
}

type QueryNegConf

type QueryNegConf struct {
	QueryAtomConf
}

type QueryOrConf

type QueryOrConf struct {
	QueryContextConf
}

type QueryRange

type QueryRange[T any] struct {
	QuerySpatialConf
	Lower  T
	Higher T
}

type QuerySpatialConf

type QuerySpatialConf interface {
	QueryConf
}

type RamCollection

type RamCollection struct {
	gonatus.Gobject
	// contains filtered or unexported fields
}

func NewRamCollection

func NewRamCollection(rc RamCollectionConf) *RamCollection

Creates new RamCollection.

Parameters:

  • rc - RamCollection Conf.

Returns:

  • pointer to a new instance of RamCollection.

func (*RamCollection) AddRecord

func (ego *RamCollection) AddRecord(rc RecordConf) (CId, error)

Adds to the RamCollection the record whose configuration is passed by the parameter, and adds it to the lookup indexes.

Parameters:

  • rc - Configuration of the Record.

Returns:

  • CId of newly added record,
  • error, if any.

func (*RamCollection) Commit

func (ego *RamCollection) Commit() error

Returns:

  • error, if any.

func (*RamCollection) DeinterpretField

func (ego *RamCollection) DeinterpretField(val any, nth int) (FielderConf, error)

Deinterprets the Field on the given index.

Parameters:

  • val - value of FieldConf,
  • nth - index of column.

Returns:

  • FielderConf,
  • error, if any.

func (*RamCollection) DeinterpretRecord

func (ego *RamCollection) DeinterpretRecord(r []any) (RecordConf, error)

Deinterprets the values of the row passed in the parameter.

Parameters:

  • r - Values of row.

Returns:

  • Configuration of Record,
  • error, if any.

func (*RamCollection) DeleteByFilter

func (ego *RamCollection) DeleteByFilter(fa FilterArgument) error

Filters the matching rows according to the given query. It then deletes them from the RamCollection and deletes them from the search indexers.

Parameters:

  • q - Configuration of the query.

Returns:

  • Error, if any.

func (*RamCollection) DeleteRecord

func (ego *RamCollection) DeleteRecord(rc RecordConf) error

Deletes from the RamCollection the record whose configuration is passed by the parameter, and deletes it from lookup indexes.

Parameters:

  • rc - Configuration of the Record.

Returns:

  • Error, if any.

func (*RamCollection) EditRecord

func (ego *RamCollection) EditRecord(rc RecordConf) error

Edits the RamCollection record whose configuration is passed by the parameter and modifies it in the lookup indexes.

Parameters:

  • rc - Configuration of Record.

Returns:

  • Error, if any.

func (*RamCollection) Filter

Filters rows based on the type and content of the query and writes them to the stream.

Parameters:

  • fa - Filter argument.

Returns:

  • Readable Output Streamer,
  • error, if any.

func (*RamCollection) Inspect

func (ego *RamCollection) Inspect()

func (*RamCollection) InterpretField

func (ego *RamCollection) InterpretField(fc FielderConf) (any, error)

Interprets the Field passed in the parameter.

Parameters:

  • fc - FielderConf.

Returns:

  • Value of FieldConf,
  • error, if any.

func (*RamCollection) InterpretRecord

func (ego *RamCollection) InterpretRecord(rc RecordConf) ([]any, error)

Interprets the Record passed in the parameter.

Parameters:

  • rc - Configuration of Record.

Returns:

  • Slice of values from a row,
  • error, if any.

func (*RamCollection) Rows

func (ego *RamCollection) Rows() map[CId][]any

Returns:

  • RamCollection's rows

func (*RamCollection) Serialize

func (ego *RamCollection) Serialize() gonatus.Conf

Serializes RamCollection.

Returns:

  • configuration of the Gobject.

type RamCollectionConf

type RamCollectionConf struct {
	SchemaConf
	MaxMemory uint64
}

RAM COLLECTION IMPL

type RecordConf

type RecordConf struct {
	Id   CId
	Cols []FielderConf
}

type SchemaConf

type SchemaConf struct {
	Name         string
	FieldsNaming []string
	Fields       []FielderConf
	Indexes      [][]IndexerConf
}

type SpatialIndexerConf

type SpatialIndexerConf interface {
}

Jump to

Keyboard shortcuts

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