Versions in this module Expand all Collapse all v0 v0.1.3 Jan 18, 2022 v0.1.2 Jan 18, 2022 v0.1.1 Dec 22, 2020 v0.1.0 Dec 7, 2020 v0.0.6 Dec 6, 2020 v0.0.5 Aug 3, 2020 Changes in this version + const EmptyLoader + var InvalidID = errors.New("invalid note id") + func Patch(a *TruncatedNote, ops []Operation) error + type Database interface + type DatabaseReader interface + IsolatedRead func(f func(r FindLoader) error) error + type DatabaseWriter interface + IsolatedWrite func(f func(rw FindLoadPatcher) error) error + type EmptyNote ID + func (x EmptyNote) GetContents() ([]GraphNote, error) + func (x EmptyNote) GetID() ID + func (x EmptyNote) GetTypes() ([]GraphNote, error) + func (x EmptyNote) GetValue() (string, GraphNote, error) + type FindLoadPatcher interface + type FindLoader interface + type Finder interface + Find func(*Query) ([]GraphNote, error) + type GraphNote interface + GetContents func() ([]GraphNote, error) + GetID func() ID + GetTypes func() ([]GraphNote, error) + GetValue func() (string, GraphNote, error) + func ExpandNote(tn TruncatedNote, l Loader) GraphNote + func LoadOne(l Loader, id ID) (GraphNote, error) + type ID string + const EmptyID + func RandomID() ID + func (id ID) Empty() bool + func (x ID) String() string + type IDSlice []ID + func (ids IDSlice) String() string + func (xs IDSlice) Append(add ...ID) IDSliceDelta + func (xs IDSlice) Apply(ops []IDSliceOp) IDSlice + func (xs IDSlice) CanApply(ops []IDSliceOp) bool + func (xs IDSlice) Delete(i, num int) IDSliceDelta + func (xs IDSlice) DeleteElements(del ...ID) IDSliceDelta + func (xs IDSlice) Insert(i int, add ...ID) IDSliceDelta + func (xs IDSlice) PrefixMatch(ys []ID) int + func (xs IDSlice) Retain(r int) IDSliceDelta + type IDSliceDelta []IDSliceOp + func IDSliceDiff(a, b []ID) IDSliceDelta + func (x IDSliceDelta) Delete(d int) IDSliceDelta + func (x IDSliceDelta) Insert(add ...ID) IDSliceDelta + func (x IDSliceDelta) Rebase(base IDSliceDelta) (IDSliceDelta, error) + func (x IDSliceDelta) Retain(r int) IDSliceDelta + type IDSliceOp interface + Apply func(IDSlice) (include IDSlice, remainder IDSlice) + Compact func(o IDSliceOp) (IDSliceOp, bool) + Leaves func(n int) int + Len func() int + Rebase func(base IDSliceOp) (r IDSliceOp, xn IDSliceOp, bn IDSliceOp) + Skip func(n int) IDSliceOp + String func() string + type IDSliceOpDelete int + func (x IDSliceOpDelete) Apply(xs IDSlice) (IDSlice, IDSlice) + func (x IDSliceOpDelete) Compact(op IDSliceOp) (IDSliceOp, bool) + func (x IDSliceOpDelete) Leaves(in int) int + func (x IDSliceOpDelete) Len() int + func (x IDSliceOpDelete) Rebase(base IDSliceOp) (IDSliceOp, IDSliceOp, IDSliceOp) + func (x IDSliceOpDelete) Skip(n int) IDSliceOp + func (x IDSliceOpDelete) String() string + type IDSliceOpInsert []ID + func (x IDSliceOpInsert) Apply(xs IDSlice) (IDSlice, IDSlice) + func (x IDSliceOpInsert) Compact(op IDSliceOp) (IDSliceOp, bool) + func (x IDSliceOpInsert) Leaves(in int) int + func (x IDSliceOpInsert) Len() int + func (x IDSliceOpInsert) Rebase(base IDSliceOp) (IDSliceOp, IDSliceOp, IDSliceOp) + func (x IDSliceOpInsert) Skip(n int) IDSliceOp + func (x IDSliceOpInsert) String() string + type IDSliceOpRetain int + func (x IDSliceOpRetain) Apply(xs IDSlice) (IDSlice, IDSlice) + func (x IDSliceOpRetain) Compact(op IDSliceOp) (IDSliceOp, bool) + func (x IDSliceOpRetain) Leaves(in int) int + func (x IDSliceOpRetain) Len() int + func (x IDSliceOpRetain) Rebase(base IDSliceOp) (IDSliceOp, IDSliceOp, IDSliceOp) + func (x IDSliceOpRetain) Skip(n int) IDSliceOp + func (x IDSliceOpRetain) String() string + type Loader interface + Load func(ids []ID) ([]GraphNote, error) + type NoteDelta []NoteOp + func NoteDeltaFromTruncatedNote(n TruncatedNote) NoteDelta + func (xs NoteDelta) ChangeContents(d IDSliceDelta) NoteDelta + func (xs NoteDelta) ChangeTypes(d IDSliceDelta) NoteDelta + func (xs NoteDelta) ChangeValueString(d runes.StringDelta) NoteDelta + func (xs NoteDelta) ChangeValueType(vt ID) NoteDelta + func (xs NoteDelta) GetContentIDs() IDSlice + func (xs NoteDelta) GetID() ID + func (xs NoteDelta) GetTypeIDs() IDSlice + func (xs NoteDelta) GetValueString() runes.String + func (xs NoteDelta) GetValueTypeID() ID + func (xs NoteDelta) SetID(id ID) NoteDelta + func (xs NoteDelta) Truncate() TruncatedNote + type NoteMapDelta []NoteMapOp + func (xs NoteMapDelta) ChangeNote(n NoteDelta) NoteMapDelta + type NoteMapOp interface + type NoteMapOpNoteDelta NoteDelta + type NoteOp interface + type NoteOpContentsDelta IDSliceDelta + type NoteOpID ID + type NoteOpTypesDelta IDSliceDelta + type NoteOpValueDelta runes.StringDelta + type NoteOpValueTypeDelta ID + type Op ID + func (x Op) AffectsID(id ID) bool + func (x Op) GetID() ID + type OpContentDelta OpIDSliceDelta + func (o OpContentDelta) String() string + type OpIDSliceDelta struct + IDSliceOps []IDSliceOp + func (o OpIDSliceDelta) String() string + type OpSetValue struct + Datatype ID + Lexical string + func (os OpSetValue) String() string + type OpSetValueString struct + Lexical string + func (os OpSetValueString) String() string + type OpTypesDelta OpIDSliceDelta + func (o OpTypesDelta) String() string + type Operation interface + AffectsID func(id ID) bool + func Diff(a, b TruncatedNote) []Operation + type OperationSlice []Operation + func (os OperationSlice) InsertContent(id ID, index int, cs ...ID) OperationSlice + func (os OperationSlice) PatchContent(id ID, ops []IDSliceOp) OperationSlice + func (os OperationSlice) PatchTypes(id ID, ops []IDSliceOp) OperationSlice + func (os OperationSlice) SetValue(id ID, vs string, vt ID) OperationSlice + func (os OperationSlice) SetValueString(id ID, vs string) OperationSlice + type Patcher interface + Patch func(ops []Operation) error + type Plain struct + Contents []*Plain + ID ID + Types []*Plain + ValueString string + ValueType *Plain + func (x *Plain) GraphNote() GraphNote + type Query struct + type Stage struct + Base Loader + Ops OperationSlice + func (x *Stage) Add(o Operation) *Stage + func (x *Stage) GetBase() Loader + func (x *Stage) Note(id ID) *StageNote + type StageNote struct + ID ID + Stage *Stage + func MustStageNote(n *StageNote, err error) *StageNote + func (x *StageNote) AddContent(id ID) (*StageNote, error) + func (x *StageNote) GetContentIDs() ([]ID, error) + func (x *StageNote) GetContents() ([]GraphNote, error) + func (x *StageNote) GetID() ID + func (x *StageNote) GetTypeIDs() ([]ID, error) + func (x *StageNote) GetTypes() ([]GraphNote, error) + func (x *StageNote) GetValue() (string, GraphNote, error) + func (x *StageNote) InsertTypes(i int, add ...ID) error + func (x *StageNote) Note(id ID) *StageNote + func (x *StageNote) SetValue(lexical string, datatype ID) error + type TruncatedNote struct + Contents []ID + ID ID + Types []ID + ValueString string + ValueType ID + func TruncateNote(n GraphNote) (TruncatedNote, error) + func (x TruncatedNote) Equals(y TruncatedNote) bool