idx

package
v0.0.0-...-5cbc45b Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidID = errors.New("invalid ID")

Functions

This section is empty.

Types

type ID

type ID[T Type] struct {
	// contains filtered or unexported fields
}

func From

func From[T Type](id string) (ID[T], error)

func FromRef

func FromRef[T Type](id *string) *ID[T]

func Must

func Must[T Type](id string) ID[T]

func New

func New[T Type]() ID[T]

func (ID[T]) Clone

func (id ID[T]) Clone() ID[T]

func (*ID[T]) CloneRef

func (id *ID[T]) CloneRef() *ID[T]

func (ID[T]) Compare

func (id ID[T]) Compare(id2 ID[T]) int

func (ID[T]) GoString

func (id ID[T]) GoString() string

GoString implements fmt.GoStringer interface.

func (ID) IsEmpty

func (id ID) IsEmpty() bool

func (*ID[T]) IsNil

func (id *ID[T]) IsNil() bool

func (ID) MarshalText

func (d ID) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler interface

func (ID[T]) Ref

func (id ID[T]) Ref() *ID[T]

func (ID) String

func (id ID) String() string

String implements fmt.Stringer interface.

func (*ID[T]) StringRef

func (id *ID[T]) StringRef() *string

func (ID) Timestamp

func (id ID) Timestamp() time.Time

func (ID[T]) Type

func (ID[T]) Type() string

func (*ID) UnmarshalText

func (id *ID) UnmarshalText(b []byte) (err error)

UnmarshalText implements encoding.TextUnmarshaler interface

type List

type List[T Type] []ID[T]

func ListFrom

func ListFrom[T Type](ids []string) (List[T], error)

func MustList

func MustList[T Type](ids []string) List[T]

func NewAll

func NewAll[T Type](n int) (l List[T])

func (List[T]) Add

func (l List[T]) Add(ids ...ID[T]) List[T]

func (List[T]) AddUniq

func (l List[T]) AddUniq(ids ...ID[T]) List[T]

func (List[T]) At

func (l List[T]) At(i int) *ID[T]

func (List[T]) Clone

func (l List[T]) Clone() List[T]

func (List[T]) Concat

func (l List[T]) Concat(m List[T]) List[T]

func (List[T]) Delete

func (l List[T]) Delete(ids ...ID[T]) List[T]

func (List[T]) DeleteAt

func (l List[T]) DeleteAt(i int) List[T]

func (List[T]) Has

func (l List[T]) Has(ids ...ID[T]) bool

func (List[T]) Index

func (l List[T]) Index(id ID[T]) int

func (List[T]) Insert

func (l List[T]) Insert(i int, ids ...ID[T]) List[T]

func (List[T]) Intersect

func (l List[T]) Intersect(m List[T]) List[T]

func (List[T]) Len

func (l List[T]) Len() int

func (List[T]) Less

func (l List[T]) Less(i, j int) bool

func (List[T]) Move

func (l List[T]) Move(e ID[T], to int) List[T]

func (List[T]) MoveAt

func (l List[T]) MoveAt(from, to int) List[T]

func (List[T]) Ref

func (l List[T]) Ref() *List[T]

func (List[T]) Refs

func (l List[T]) Refs() RefList[T]

func (List[T]) Reverse

func (l List[T]) Reverse() List[T]

func (List[T]) Set

func (l List[T]) Set() *Set[T]

func (List[T]) Sort

func (l List[T]) Sort() List[T]

func (List[T]) Strings

func (l List[T]) Strings() []string

func (List[T]) Swap

func (l List[T]) Swap(i, j int)

type RefList

type RefList[T Type] []*ID[T]

func (RefList[T]) Deref

func (l RefList[T]) Deref() List[T]

type Set

type Set[T Type] struct {
	// contains filtered or unexported fields
}

func NewSet

func NewSet[T Type](id ...ID[T]) *Set[T]

func (*Set[T]) Add

func (s *Set[T]) Add(id ...ID[T])

func (*Set[T]) Clone

func (s *Set[T]) Clone() *Set[T]

func (*Set[T]) Concat

func (s *Set[T]) Concat(sets ...*Set[T]) *Set[T]

func (*Set[T]) Delete

func (s *Set[T]) Delete(id ...ID[T])

func (*Set[T]) Has

func (s *Set[T]) Has(id ...ID[T]) bool

func (*Set[T]) List

func (s *Set[T]) List() List[T]

func (*Set[T]) Merge

func (s *Set[T]) Merge(sets ...*Set[T])

type StringID

type StringID[T Type] string

func StringIDFromRef

func StringIDFromRef[T Type](id *string) *StringID[T]

func (*StringID[T]) CloneRef

func (id *StringID[T]) CloneRef() *StringID[T]

func (StringID[T]) Ref

func (id StringID[T]) Ref() *StringID[T]

func (StringID[_]) String

func (id StringID[_]) String() string

func (*StringID[_]) StringRef

func (id *StringID[_]) StringRef() *string

type Type

type Type interface {
	Type() string
}

Jump to

Keyboard shortcuts

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