store

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMainAlreadyExists  error = errors.New("main note already exists")
	ErrGroupAlreadyExists error = errors.New("group already exists")
	ErrMainSetNotFound    error = errors.New("main note not found")
	ErrTagAlreadyExists   error = errors.New("tag already exists")
	ErrInvalidNoteType    error = errors.New("invalid note type")
	ErrTagNotProvided     error = errors.New("tag not provided")
	ErrGroupNotFound      error = errors.New("group not found")
	ErrNoteNotFound       error = errors.New("note not found")
	ErrKeyNotFound        error = errors.New("key not found")
	ErrTagInvalid         error = errors.New("tag invalid")
)

Functions

This section is empty.

Types

type Box

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

func New

func New() *Box

func (*Box) CleanHistoryOf

func (d *Box) CleanHistoryOf(key string) error

func (*Box) CleanHistoryOfAll

func (d *Box) CleanHistoryOfAll() error

func (*Box) Delete

func (d *Box) Delete(key string) error

func (*Box) DeleteGroup

func (d *Box) DeleteGroup(name string) error

func (*Box) DeleteGroupWithRelated

func (d *Box) DeleteGroupWithRelated(name string) error

func (*Box) Get

func (d *Box) Get(key string) (Note, error)

func (*Box) GetGroups

func (d *Box) GetGroups() []string

func (*Box) GetHistoryOf

func (d *Box) GetHistoryOf(key string) ([]Change, error)

func (*Box) GetLastKey

func (d *Box) GetLastKey() string

func (*Box) GetMainKey

func (d *Box) GetMainKey() (string, error)

func (*Box) GroupExists

func (d *Box) GroupExists(name string) bool

func (*Box) GroupOf

func (d *Box) GroupOf(key string) (string, error)

func (*Box) List

func (d *Box) List() []NoteView

func (*Box) ListAllKeys

func (d *Box) ListAllKeys() []string

func (*Box) MainAlreadyExists

func (d *Box) MainAlreadyExists() bool

func (*Box) ManyNewFrom

func (d *Box) ManyNewFrom(notes []Note) ([]string, error)

func (*Box) ModifyAssignedGroup

func (d *Box) ModifyAssignedGroup(key, name string) error

func (*Box) ModifyContent

func (d *Box) ModifyContent(key string, content string) error

func (*Box) ModifyGroupName

func (d *Box) ModifyGroupName(oldName, newName string) error

func (*Box) ModifyTag

func (d *Box) ModifyTag(key string, tag string) error

func (*Box) ModifyType

func (d *Box) ModifyType(key string, sType string) error

func (*Box) New

func (d *Box) New(content, contentType string) (string, error)

func (*Box) NewFrom

func (d *Box) NewFrom(note Note) (string, error)

func (*Box) NewGroup

func (d *Box) NewGroup(name string) error

func (*Box) NewWithTag

func (d *Box) NewWithTag(content, contentType, tag string) (string, error)

func (*Box) RemoveFromAssignedGroup

func (d *Box) RemoveFromAssignedGroup(key string) error

func (*Box) Replace

func (d *Box) Replace(key string, note Note) error

func (*Box) ReplaceBox

func (d *Box) ReplaceBox(box BoxData)

func (*Box) ResetTo

func (d *Box) ResetTo(key, subKey string) error

func (*Box) ResetToBefore

func (d *Box) ResetToBefore(key string) error

func (*Box) ResetToWithDeletions

func (d *Box) ResetToWithDeletions(key, subKey string) error

func (*Box) SearchByKeyPattern

func (d *Box) SearchByKeyPattern(pattern string) (string, Note, error)

func (*Box) SearchByKeyTagPattern

func (d *Box) SearchByKeyTagPattern(pattern string) (string, Note, error)

func (*Box) TagAlreadyExists

func (d *Box) TagAlreadyExists(tag string) bool

func (*Box) TagIsValid

func (d *Box) TagIsValid(tag string) error

type BoxData

type BoxData struct {
	LastAccess string          `json:"lastSet"`
	NaoSet     map[string]Note `json:"naoSet"`
	Groups     []string        `json:"groups"`
}

func JustLoadBox

func JustLoadBox() BoxData

type Change

type Change struct {
	Key       string    `json:"key"`
	Content   string    `json:"content"`
	Timestamp time.Time `json:"timestamp"`
}

type Note

type Note struct {
	Tag        string    `json:"tag,omitempty"`
	Type       string    `json:"type"`
	ShadowType string    `json:"shadowType"`
	Group      string    `json:"group"`
	Content    string    `json:"content"`
	Extension  string    `json:"extension,omitempty"`
	History    []Change  `json:"history"`
	Title      string    `json:"title,omitempty"`
	LastUpdate time.Time `json:"lastUpdate"`
	Version    int       `json:"version"`
}

type NoteView

type NoteView struct {
	Tag        string    `json:"tag"`
	Key        string    `json:"key"`
	Type       string    `json:"type"`
	Size       string    `json:"size"`
	Content    string    `json:"content"`
	Group      string    `json:"group"`
	Title      string    `json:"title"`
	Extension  string    `json:"extension"`
	LastUpdate time.Time `json:"lastUpdate"`
	Version    int       `json:"version"`
}

type SetModifier

type SetModifier interface {
	ModifyContent(key string, content string) error
	ModifyType(key string, sType string) error
}

type Window

type Window struct {
	Hash       string
	Tag        string
	LastUpdate time.Time
}

Jump to

Keyboard shortcuts

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