index

package
v0.0.0-...-7899014 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cancel = errors.New("cancel")
View Source
var ErrInvalidEntry = errors.New("invalid entry")
View Source
var MatchEntry = NewEntry
View Source
var MatchPreEntry = NewPreEntry
View Source
var TestingIndex = testingIndex{}
View Source
var TestingIndex2 = testingIndex2{}

Functions

func Iter

func Iter(
	options ...IterOption,
) (
	fn func(
		index Index,
	) (
		Src,
		io.Closer,
		error,
	),
)

func Register

func Register(o any)

func RegisterIndex

func RegisterIndex(name string, t reflect.Type)

func Select

func Select(
	index Index,
	options ...SelectOption,
) (
	err error,
)

func TestIdxUnknown

func TestIdxUnknown(
	t *testing.T,
)

func TestTuple

func TestTuple(
	t *testing.T,
)

Types

type AssignCount

type AssignCount [1]*int

func Count

func Count(target *int) AssignCount

func (AssignCount) IsIterOption

func (_ AssignCount) IsIterOption()

func (AssignCount) IsSelectOption

func (_ AssignCount) IsSelectOption()

type Def

type Def struct{}

func (Def) Index

func (_ Def) Index(
	manager IndexManager,
	storeID StoreID,
) Index

func (Def) SelectIndex

func (Def) SelectIndex(
	index Index,
) SelectIndex

func (Def) TestIndex

func (Def) TestIndex(
	scope Scope,
) TestIndex

type Entry

type Entry struct {
	Type  any
	Tuple sb.Tuple
	Key   *Key
	Path  *[]Key
}

func NewEntry

func NewEntry(indexType any, args ...any) Entry

func (Entry) Clone

func (e Entry) Clone() Entry

func (Entry) IsIterOption

func (_ Entry) IsIterOption()

func (Entry) IsSelectOption

func (_ Entry) IsSelectOption()

func (Entry) IsUnknown

func (e Entry) IsUnknown() bool

func (Entry) MarshalSB

func (e Entry) MarshalSB(ctx sb.Ctx, cont sb.Proc) sb.Proc

func (*Entry) UnmarshalSB

func (e *Entry) UnmarshalSB(ctx sb.Ctx, cont sb.Sink) sb.Sink

type Exact

type Exact Entry

func (Exact) IsIterOption

func (_ Exact) IsIterOption()

func (Exact) IsSelectOption

func (_ Exact) IsSelectOption()

type Index

type Index interface {
	Name() string
	Iter(
		lower *sb.Tokens,
		upper *sb.Tokens,
		order Order,
	) (Src, io.Closer, error)
	Save(entry Entry, options ...SaveOption) error
	Delete(entry Entry) error
}

type IndexManager

type IndexManager interface {
	Name() string
	IndexFor(StoreID) (Index, error)
}

type IterOption

type IterOption interface {
	IsIterOption()
}

type IterOptions

type IterOptions []IterOption

func (IterOptions) IsIterOption

func (_ IterOptions) IsIterOption()

func (IterOptions) IsSelectOption

func (_ IterOptions) IsSelectOption()

type Key

type Key = key.Key

type Limit

type Limit int

func (Limit) IsIterOption

func (_ Limit) IsIterOption()

func (Limit) IsSelectOption

func (_ Limit) IsSelectOption()

type Lower

type Lower Entry

func (Lower) IsIterOption

func (_ Lower) IsIterOption()

func (Lower) IsSelectOption

func (_ Lower) IsSelectOption()

type Offset

type Offset int

func (Offset) IsIterOption

func (_ Offset) IsIterOption()

func (Offset) IsSelectOption

func (_ Offset) IsSelectOption()

type Order

type Order uint8
const (
	Asc Order = iota
	Desc
)

func (Order) IsIterOption

func (_ Order) IsIterOption()

func (Order) IsSelectOption

func (_ Order) IsSelectOption()

type PreEntry

type PreEntry struct {
	Key   Key
	Type  any
	Tuple sb.Tuple
}

func NewPreEntry

func NewPreEntry(key Key, indexType any, args ...any) PreEntry

func (PreEntry) Clone

func (e PreEntry) Clone() PreEntry

func (PreEntry) IsIterOption

func (_ PreEntry) IsIterOption()

func (PreEntry) IsSelectOption

func (_ PreEntry) IsSelectOption()

func (PreEntry) MarshalSB

func (e PreEntry) MarshalSB(ctx sb.Ctx, cont sb.Proc) sb.Proc

func (*PreEntry) UnmarshalSB

func (e *PreEntry) UnmarshalSB(ctx sb.Ctx, cont sb.Sink) sb.Sink

type SaveOption

type SaveOption interface {
	IsSaveOption()
}

type Scope

type Scope = dscope.Scope

type SelectIndex

type SelectIndex func(
	ctx context.Context,
	args ...SelectOption,
) error

type SelectOption

type SelectOption interface {
	IsSelectOption()
}

type SelectOptions

type SelectOptions []SelectOption

func (SelectOptions) IsSelectOption

func (_ SelectOptions) IsSelectOption()

type Sink

type Sink func() sb.Sink

func Tap

func Tap(fn any) Sink

func TapPre

func TapPre(fn any) Sink

func Unmarshal

func Unmarshal(fn any) Sink

func (Sink) IsSelectOption

func (_ Sink) IsSelectOption()

type Spec

type Spec struct {
	Name   string
	Type   reflect.Type
	Fields []reflect.Type
}

type Src

type Src = pp.Src

func IterStreams

func IterStreams(streams []sb.Stream) Src

type Store

type Store = store.Store

type StoreID

type StoreID = store.ID

type StoreIndex

type StoreIndex struct {
	Value sb.Stream
	ID    StoreID
}

func (StoreIndex) MarshalSB

func (s StoreIndex) MarshalSB(ctx sb.Ctx, cont sb.Proc) sb.Proc

type TapEntry

type TapEntry func(Entry)

func (TapEntry) IsSaveOption

func (_ TapEntry) IsSaveOption()

func (TapEntry) IsSelectOption

func (_ TapEntry) IsSelectOption()

type TapKey

type TapKey = opts.TapKey

type TapTokens

type TapTokens func(sb.Tokens)

func (TapTokens) IsSelectOption

func (_ TapTokens) IsSelectOption()

type TestIndex

type TestIndex func(
	withIndexManager func(func(IndexManager)),
	t *testing.T,
)

test Index implementation

type Upper

type Upper Entry

func (Upper) IsIterOption

func (_ Upper) IsIterOption()

func (Upper) IsSelectOption

func (_ Upper) IsSelectOption()

type Where

type Where func(sb.Stream) bool

func (Where) IsIterOption

func (_ Where) IsIterOption()

func (Where) IsSelectOption

func (_ Where) IsSelectOption()

type WithCtx

type WithCtx [1]context.Context

func (WithCtx) IsSelectOption

func (_ WithCtx) IsSelectOption()

Jump to

Keyboard shortcuts

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