ids

package
v0.0.0-...-32d88a2 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SigilUnknown = Sigil(iota)
	SigilLatest  = Sigil(1 << iota)
	SigilHistory
	SigilExternal
	SigilHidden

	SigilMax
	SigilAll = Sigil(^byte(0))
)
View Source
const RepoIdRegexString = `^(/)?[-a-z0-9_]+$`
View Source
const Tag2RegexString = `^%?[-a-z0-9_]+$`
View Source
const TagRegexString = `^%?[-a-z0-9_]+$`

Variables

View Source
var ErrFDNotId = errors.New("not a id file")
View Source
var RepoIdRegex *regexp.Regexp
View Source
var Tag2Regex *regexp.Regexp
View Source
var TagRegex *regexp.Regexp
View Source
var TagResetter = sTagResetter

Functions

func AddNormalizedTag

func AddNormalizedTag(es TagMutableSet, e *Tag)

func Aligned

func Aligned(id IdLike, lenLeft, lenRight int) string

func AlignedParts

func AlignedParts(
	id IdLike,
	lenLeft, lenRight int,
) (string, string, string)

func Contains

func Contains(a, b IdWithParts) bool

func ContainsExactly

func ContainsExactly(a, b IdWithParts) bool

func DontAbbreviateString

func DontAbbreviateString[VPtr interfaces.Stringer](k VPtr) (string, error)

func DontExpandString

func DontExpandString(v string) (string, error)

func Equals

func Equals(a, b IdLike) (ok bool)

func ErrOnConfig

func ErrOnConfig(v string) (err error)

func ErrOnConfigBytes

func ErrOnConfigBytes(b []byte) (err error)

func ExpandMany

func ExpandMany[T idExpandable[T], TPtr idExpandablePtr[T]](
	ks interfaces.SetPtrLike[T, TPtr],
	ex expansion.Expander,
) (out interfaces.SetPtrLike[T, TPtr])

func ExpandOneInto

func ExpandOneInto[T IdLike](
	k T,
	mf func(string) (T, error),
	ex expansion.Expander,
	acc interfaces.Adder[T],
)

func ExpandOneSlice

func ExpandOneSlice[T IdLike](
	k T,
	mf func(string) (T, error),
	exes ...expansion.Expander,
) (out []T)

func FormattedString

func FormattedString(k IdWithParts) string

func GetObjectIdPool

func GetObjectIdPool() interfaces.Pool[ObjectId, *ObjectId]

func GetTagPool

func GetTagPool() interfaces.Pool[Tag, *Tag]

func HasParentPrefix

func HasParentPrefix(a, b Tag) (has bool)

func IsDependentLeaf

func IsDependentLeaf(a Tag) (has bool)

func IsEmpty

func IsEmpty[T interfaces.Stringer](a T) bool

func IsErrInvalid

func IsErrInvalid(err error) bool

func IsErrInvalidSigil

func IsErrInvalidSigil(err error) bool

func LeftSubtract

func LeftSubtract[
	T interfaces.Stringer,
	TPtr interfaces.StringSetterPtr[T],
](
	a, b T,
) (c T, err error)

func RemovePrefixes

func RemovePrefixes(es TagMutableSet, needle Tag)

func SigilFieldFunc

func SigilFieldFunc(c rune) (ok bool)

func TagSetEquals

func TagSetEquals(a, b TagSet) bool

Types

type Abbr

type Abbr struct {
	Sha      abbrOne
	ZettelId abbrOne
}

func (Abbr) AbbreviateObjectId

func (a Abbr) AbbreviateObjectId(
	in *ObjectId,
	out *ObjectId,
) (err error)

func (Abbr) AbbreviateZettelIdOnly

func (a Abbr) AbbreviateZettelIdOnly(
	in *ObjectId,
) (err error)

func (Abbr) ExpandZettelIdOnly

func (a Abbr) ExpandZettelIdOnly(
	in *ObjectId,
) (err error)

func (Abbr) ExpanderFor

func (a Abbr) ExpanderFor(g genres.Genre) FuncExpandString

func (Abbr) LenHeadAndTail

func (a Abbr) LenHeadAndTail(
	in *ObjectId,
) (head, tail int, err error)

type Abbreviatable

type Abbreviatable interface {
	interfaces.Stringer
}

type Clock

type Clock interface {
	GetTai() Tai
}

type Config

type Config struct{}

func (Config) Equals

func (a Config) Equals(b Config) bool

func (Config) EqualsAny

func (a Config) EqualsAny(b any) bool

func (Config) GetGenre

func (a Config) GetGenre() interfaces.Genre

func (Config) MarshalBinary

func (t Config) MarshalBinary() (text []byte, err error)

func (Config) MarshalText

func (t Config) MarshalText() (text []byte, err error)

func (Config) Parts

func (k Config) Parts() [3]string

func (*Config) Reset

func (a *Config) Reset()

func (*Config) ResetWith

func (a *Config) ResetWith(_ Config)

func (Config) Set

func (i Config) Set(v string) (err error)

func (Config) String

func (i Config) String() string

func (*Config) UnmarshalBinary

func (t *Config) UnmarshalBinary(text []byte) (err error)

func (*Config) UnmarshalText

func (t *Config) UnmarshalText(text []byte) (err error)

type DumbObjectId

type DumbObjectId struct {
	Value string
	Genre genres.Genre
}

func (*DumbObjectId) CloneExternalObjectId

func (a *DumbObjectId) CloneExternalObjectId() ExternalObjectId

func (*DumbObjectId) GetExternalObjectId

func (a *DumbObjectId) GetExternalObjectId() ExternalObjectId

func (*DumbObjectId) GetGenre

func (a *DumbObjectId) GetGenre() interfaces.Genre

func (*DumbObjectId) IsEmpty

func (a *DumbObjectId) IsEmpty() bool

func (*DumbObjectId) String

func (a *DumbObjectId) String() string

type ErrInvalidId

type ErrInvalidId string

func (ErrInvalidId) Error

func (e ErrInvalidId) Error() string

func (ErrInvalidId) Is

func (e ErrInvalidId) Is(err error) (ok bool)

type ExternalObjectIdCloner

type ExternalObjectIdCloner interface {
	CloneExternalObjectId() ExternalObjectId
}

type ExternalObjectIdGetter

type ExternalObjectIdGetter interface {
	GetExternalObjectId() ExternalObjectId
}

type Field

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

func (*Field) SetCatgutString

func (f *Field) SetCatgutString(v *catgut.String) (err error)

type FuncAbbreviateString

type FuncAbbreviateString func(Abbreviatable) (string, error)

type FuncExpandString

type FuncExpandString func(string) (string, error)

TODO use catgut.String

type Genre

type Genre byte

func MakeGenre

func MakeGenre(vs ...genres.Genre) (s Genre)

func MakeGenreAll

func MakeGenreAll() Genre

func (*Genre) Add

func (a *Genre) Add(bs ...genres.Genre)

func (*Genre) AddString

func (i *Genre) AddString(v string) (err error)

func (Genre) Byte

func (i Genre) Byte() byte

func (Genre) Contains

func (a Genre) Contains(b interfaces.GenreGetter) bool

func (Genre) ContainsOneOf

func (a Genre) ContainsOneOf(b interfaces.GenreGetter) bool

func (*Genre) Del

func (a *Genre) Del(b interfaces.GenreGetter)

func (Genre) Equals

func (a Genre) Equals(b Genre) bool

func (Genre) EqualsAny

func (a Genre) EqualsAny(b any) bool

func (Genre) GetSha

func (i Genre) GetSha() *sha.Sha

func (Genre) IsEmpty

func (a Genre) IsEmpty() bool

func (Genre) ReadByte

func (i Genre) ReadByte() (byte, error)

func (*Genre) ReadFrom

func (i *Genre) ReadFrom(r io.Reader) (n int64, err error)

func (*Genre) ReadFromTokenScanner

func (g *Genre) ReadFromTokenScanner(
	ts *query_spec.TokenScanner,
) (err error)

func (*Genre) Reset

func (a *Genre) Reset()

func (*Genre) ResetWith

func (a *Genre) ResetWith(b Genre)

func (*Genre) Set

func (gs *Genre) Set(v string) (err error)

func (Genre) Slice

func (a Genre) Slice() []genres.Genre

func (Genre) String

func (a Genre) String() string

func (*Genre) WriteTo

func (i *Genre) WriteTo(w io.Writer) (n int64, err error)

type IdLike

type IdLike interface {
	IdWithParts
	interfaces.GenreGetter
}

func Make

func Make(v string) (k IdLike, err error)

type IdParts

type IdParts struct {
	Middle              byte
	RepoId, Left, Right *catgut.String
}

type IdWithParts

type IdWithParts interface {
	interfaces.Stringer
	Parts() [3]string
}

type Index

type Index struct{}

type IndexedLike

type IndexedLike struct {
	Int int
	ObjectId
	SchwanzenCount int
	Count          int
}

func MakeIndexed

func MakeIndexed(k IdLike) (i *IndexedLike)

func (*IndexedLike) GetCount

func (k *IndexedLike) GetCount() int

func (*IndexedLike) GetInt

func (z *IndexedLike) GetInt() int

func (*IndexedLike) GetObjectId

func (z *IndexedLike) GetObjectId() IdLike

func (*IndexedLike) GetSchwanzenCount

func (k *IndexedLike) GetSchwanzenCount() int

func (*IndexedLike) Reset

func (z *IndexedLike) Reset()

func (*IndexedLike) ResetWithObjectId

func (i *IndexedLike) ResetWithObjectId(k IdLike)

type IndexedTag

type IndexedTag = IndexedLike

type IndexedTag2

type IndexedTag2 = IndexedLike

type InlineTypeChecker

type InlineTypeChecker interface {
	IsInlineType(Type) bool
}

type ObjectId

type ObjectId = objectId2

func MustObjectId

func MustObjectId(kp IdLike) (k *ObjectId)

type ObjectIdGetter

type ObjectIdGetter interface {
	GetObjectId() *ObjectId
}

type ObjectIdLike

type ObjectIdLike interface {
	interfaces.GenreGetter
	interfaces.Stringer
	// GetObjectId() *ObjectId
	IsEmpty() bool
}

type ObjectIdStringerSansRepo

type ObjectIdStringerSansRepo ObjectId

func (*ObjectIdStringerSansRepo) String

func (oid *ObjectIdStringerSansRepo) String() string

type ObjectIdStringerWithRepo

type ObjectIdStringerWithRepo ObjectId

func (*ObjectIdStringerWithRepo) String

func (oid *ObjectIdStringerWithRepo) String() string

type Provider

type Provider interface {
	MakeZettelIdFromCoordinates(i coordinates.Int) (string, error)
}

type RepoId

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

func MakeRepoId

func MakeRepoId(v string) (e *RepoId, err error)

func MustRepoId

func MustRepoId(v string) (e *RepoId)

func (RepoId) Equals

func (a RepoId) Equals(b RepoId) bool

func (RepoId) EqualsAny

func (a RepoId) EqualsAny(b any) bool

func (RepoId) EqualsRepoId

func (k RepoId) EqualsRepoId(kg interfaces.RepoIdGetter) bool

func (RepoId) GetGenre

func (o RepoId) GetGenre() interfaces.Genre

func (RepoId) GetQueryPrefix

func (k RepoId) GetQueryPrefix() string

func (RepoId) GetRepoId

func (k RepoId) GetRepoId() interfaces.RepoId

func (RepoId) GetRepoIdString

func (k RepoId) GetRepoIdString() string

func (RepoId) IsEmpty

func (k RepoId) IsEmpty() bool

func (RepoId) MarshalBinary

func (t RepoId) MarshalBinary() (text []byte, err error)

func (RepoId) MarshalText

func (t RepoId) MarshalText() (text []byte, err error)

func (RepoId) Parts

func (k RepoId) Parts() [3]string

func (*RepoId) Reset

func (e *RepoId) Reset()

func (*RepoId) ResetWith

func (e *RepoId) ResetWith(e1 RepoId)

func (*RepoId) Set

func (e *RepoId) Set(v string) (err error)

func (RepoId) String

func (k RepoId) String() string

func (*RepoId) UnmarshalBinary

func (t *RepoId) UnmarshalBinary(text []byte) (err error)

func (*RepoId) UnmarshalText

func (t *RepoId) UnmarshalText(text []byte) (err error)

type Sigil

type Sigil byte

func MakeSigil

func MakeSigil(vs ...Sigil) (s Sigil)

func (*Sigil) Add

func (a *Sigil) Add(b Sigil)

func (Sigil) Byte

func (i Sigil) Byte() byte

func (Sigil) Contains

func (a Sigil) Contains(b Sigil) bool

func (Sigil) ContainsOneOf

func (a Sigil) ContainsOneOf(b Sigil) bool

func (*Sigil) Del

func (a *Sigil) Del(b Sigil)

func (Sigil) Equals

func (a Sigil) Equals(b Sigil) bool

func (Sigil) EqualsAny

func (a Sigil) EqualsAny(b any) bool

func (Sigil) GetGattung

func (a Sigil) GetGattung() interfaces.Genre

func (Sigil) GetSha

func (i Sigil) GetSha() *sha.Sha

func (Sigil) GetSigil

func (a Sigil) GetSigil() interfaces.Sigil

func (*Sigil) GetSigilPtr

func (a *Sigil) GetSigilPtr() *Sigil

func (Sigil) IncludesExternal

func (a Sigil) IncludesExternal() bool

func (Sigil) IncludesHidden

func (a Sigil) IncludesHidden() bool

func (Sigil) IncludesHistory

func (a Sigil) IncludesHistory() bool

func (Sigil) IncludesLatest

func (a Sigil) IncludesLatest() bool

func (Sigil) IsEmpty

func (a Sigil) IsEmpty() bool

func (Sigil) IsLatestOrUnknown

func (a Sigil) IsLatestOrUnknown() bool

func (Sigil) ReadByte

func (i Sigil) ReadByte() (byte, error)

func (*Sigil) ReadFrom

func (i *Sigil) ReadFrom(r io.Reader) (n int64, err error)

func (*Sigil) Reset

func (a *Sigil) Reset()

func (*Sigil) ResetWith

func (a *Sigil) ResetWith(b Sigil)

func (*Sigil) Set

func (i *Sigil) Set(v string) (err error)

func (Sigil) String

func (a Sigil) String() string

func (*Sigil) WriteTo

func (i *Sigil) WriteTo(w io.Writer) (n int64, err error)

type Tag

type Tag = tag

func MakeTag

func MakeTag(v string) (e Tag, err error)

func MustTag

func MustTag(v string) (e Tag)

func MustTagPtr

func MustTagPtr(v string) (e *Tag)

type TagMutableSet

type TagMutableSet = interfaces.MutableSetPtrLike[Tag, *Tag]

func MakeMutableTagSet

func MakeMutableTagSet(hs ...Tag) TagMutableSet

func MakeTagMutableSet

func MakeTagMutableSet(hs ...Tag) TagMutableSet

type TagSet

type TagSet = interfaces.SetPtrLike[Tag, *Tag]
var TagSetEmpty TagSet

func Expanded

func Expanded(s TagSet, ex expansion.Expander) (out TagSet)

func IntersectPrefixes

func IntersectPrefixes(haystack TagSet, needle Tag) (s3 TagSet)

func MakeTagSet

func MakeTagSet(es ...Tag) (s TagSet)

func MakeTagSetStrings

func MakeTagSetStrings(vs ...string) (s TagSet, err error)

func SubtractPrefix

func SubtractPrefix(s1 TagSet, e Tag) (s2 TagSet)

func WithRemovedCommonPrefixes

func WithRemovedCommonPrefixes(s TagSet) (s2 TagSet)

type TagSlice

type TagSlice []Tag

func MakeTagSlice

func MakeTagSlice(es ...Tag) (s TagSlice)

func NewSliceFromStrings

func NewSliceFromStrings(es ...string) (s TagSlice, err error)

func (*TagSlice) Add

func (es *TagSlice) Add(e Tag)

func (*TagSlice) AddString

func (es *TagSlice) AddString(v string) (err error)

func (*TagSlice) DropFirst

func (s *TagSlice) DropFirst()

func (TagSlice) Len

func (s TagSlice) Len() int

func (*TagSlice) Set

func (s *TagSlice) Set(v string) (err error)

func (TagSlice) SortedString

func (es TagSlice) SortedString() (out []string)

func (TagSlice) String

func (s TagSlice) String() string

func (TagSlice) ToSet

func (s TagSlice) ToSet() TagSet

type Tai

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

func NowTai

func NowTai() Tai

func TaiFromTime

func TaiFromTime(t1 thyme.Time) (t2 Tai)

func TaiFromTime1

func TaiFromTime1(t1 time.Time) (t2 Tai)

func TaiFromTimeWithIndex

func TaiFromTimeWithIndex(t1 thyme.Time, n int) (t2 Tai)

func (Tai) After

func (a Tai) After(b Tai) bool

func (Tai) AsTime

func (t Tai) AsTime() (t1 thyme.Time)

func (Tai) Before

func (a Tai) Before(b Tai) bool

func (Tai) Equals

func (t Tai) Equals(t1 Tai) bool

func (Tai) EqualsAny

func (a Tai) EqualsAny(b any) bool

func (Tai) Format

func (t Tai) Format(v string) string

func (Tai) GetGenre

func (t Tai) GetGenre() interfaces.Genre

func (Tai) GetTai

func (t Tai) GetTai() Tai

func (Tai) IsEmpty

func (t Tai) IsEmpty() (ok bool)

func (Tai) IsZero

func (t Tai) IsZero() (ok bool)

func (Tai) Less

func (t Tai) Less(t1 Tai) bool

func (Tai) MarshalBinary

func (t Tai) MarshalBinary() (text []byte, err error)

func (Tai) MarshalText

func (t Tai) MarshalText() (text []byte, err error)

func (Tai) Parts

func (t Tai) Parts() [3]string

func (*Tai) ReadFrom

func (t *Tai) ReadFrom(r io.Reader) (n int64, err error)

func (*Tai) Reset

func (t *Tai) Reset()

func (*Tai) ResetWith

func (t *Tai) ResetWith(b Tai)

func (*Tai) Set

func (t *Tai) Set(v string) (err error)

func (*Tai) SetFromRFC3339

func (t *Tai) SetFromRFC3339(v string) (err error)

func (Tai) String

func (t Tai) String() (v string)

func (Tai) StringDefaultFormat

func (t Tai) StringDefaultFormat() string

func (*Tai) UnmarshalBinary

func (t *Tai) UnmarshalBinary(text []byte) (err error)

func (*Tai) UnmarshalText

func (t *Tai) UnmarshalText(text []byte) (err error)

func (Tai) WriteTo

func (t Tai) WriteTo(w io.Writer) (n int64, err error)

type TaiRFC3339Value

type TaiRFC3339Value Tai

func (*TaiRFC3339Value) Set

func (t *TaiRFC3339Value) Set(v string) (err error)

func (*TaiRFC3339Value) String

func (t *TaiRFC3339Value) String() string

type Type

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

func MakeType

func MakeType(v string) (t Type, err error)

func MustType

func MustType(v string) (t Type)

func (Type) Equals

func (a Type) Equals(b Type) bool

func (Type) EqualsAny

func (a Type) EqualsAny(b any) bool

func (Type) GetGenre

func (o Type) GetGenre() interfaces.Genre

func (*Type) GetTypPtr

func (t *Type) GetTypPtr() *Type

func (Type) GetType

func (t Type) GetType() Type

func (Type) IsEmpty

func (t Type) IsEmpty() bool

func (Type) IsToml

func (t Type) IsToml() bool

func (Type) MarshalBinary

func (t Type) MarshalBinary() (text []byte, err error)

func (Type) MarshalText

func (t Type) MarshalText() (text []byte, err error)

func (Type) Parts

func (t Type) Parts() [3]string

func (*Type) Reset

func (t *Type) Reset()

func (*Type) ResetWith

func (a *Type) ResetWith(b Type)

func (*Type) Set

func (e *Type) Set(v string) (err error)

func (Type) String

func (e Type) String() string

func (*Type) TodoSetFromObjectId

func (e *Type) TodoSetFromObjectId(v *ObjectId) (err error)

func (*Type) UnmarshalBinary

func (t *Type) UnmarshalBinary(text []byte) (err error)

func (*Type) UnmarshalText

func (t *Type) UnmarshalText(text []byte) (err error)

type TypeMutableSet

type TypeMutableSet = interfaces.MutableSetPtrLike[Type, *Type]

func MakeMutableTypeSet

func MakeMutableTypeSet(hs ...Type) TypeMutableSet

func MakeTypMutableSet

func MakeTypMutableSet(hs ...Type) TypeMutableSet

type TypeSet

type TypeSet = interfaces.SetPtrLike[Type, *Type]

func MakeTypSet

func MakeTypSet(es ...Type) (s TypeSet)

func MakeTypSetStrings

func MakeTypSetStrings(vs ...string) (s TypeSet, err error)

type TypedBlob

type TypedBlob[T any] struct {
	Type Type
	Blob T
}

type ZettelId

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

func MakeZettelId

func MakeZettelId(v string) (h *ZettelId, err error)

func MakeZettelIdFromHeadAndTail

func MakeZettelIdFromHeadAndTail(head, tail string) (h *ZettelId, err error)

func MakeZettelIdFromProvidersAndCoordinates

func MakeZettelIdFromProvidersAndCoordinates(
	i coordinates.Int,
	pl Provider,
	pr Provider,
) (h *ZettelId, err error)

TODO-P3 is this really necessary?;w

func MustZettelId

func MustZettelId(v string) (h *ZettelId)

func NewZettelIdEmpty

func NewZettelIdEmpty() (h ZettelId)

func (ZettelId) Equals

func (a ZettelId) Equals(b ZettelId) bool

func (ZettelId) EqualsAny

func (a ZettelId) EqualsAny(b any) bool

func (ZettelId) GetGenre

func (h ZettelId) GetGenre() interfaces.Genre

func (ZettelId) GetHead

func (h ZettelId) GetHead() string

func (ZettelId) GetTail

func (h ZettelId) GetTail() string

func (ZettelId) Less

func (i ZettelId) Less(j ZettelId) bool

func (ZettelId) MarshalBinary

func (t ZettelId) MarshalBinary() (text []byte, err error)

func (ZettelId) MarshalText

func (t ZettelId) MarshalText() (text []byte, err error)

func (ZettelId) Parts

func (h ZettelId) Parts() [3]string

func (*ZettelId) Reset

func (h *ZettelId) Reset()

func (*ZettelId) ResetWith

func (h *ZettelId) ResetWith(h1 ZettelId)

func (*ZettelId) Set

func (h *ZettelId) Set(v string) (err error)

func (*ZettelId) SetFromIdParts

func (h *ZettelId) SetFromIdParts(parts [3]string) (err error)

func (ZettelId) String

func (h ZettelId) String() string

func (*ZettelId) UnmarshalBinary

func (t *ZettelId) UnmarshalBinary(text []byte) (err error)

func (*ZettelId) UnmarshalText

func (t *ZettelId) UnmarshalText(text []byte) (err error)

type ZettelIdMutableSet

type ZettelIdMutableSet = interfaces.MutableSetLike[ZettelId]

func MakeZettelIdMutableSet

func MakeZettelIdMutableSet(hs ...ZettelId) ZettelIdMutableSet

type ZettelIdSet

type ZettelIdSet = interfaces.SetLike[ZettelId]

Jump to

Keyboard shortcuts

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