sqlite

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Overview

Package sqlite implements a sako repository backed by a SQLite database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SchemaVersion

func SchemaVersion() int

Types

type Store

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

Store is a SQLite-backed sako repository.

func Create

func Create(root string) (*Store, error)

Create creates a new sqlite repository under root.

func Open

func Open(root string) (*Store, error)

Open opens the named sqlite repository.

func (*Store) AddAnnotation

func (store *Store) AddAnnotation(ctx context.Context, id sako.EntryID, ann sako.Annotation) error

func (*Store) AddEntry

func (store *Store) AddEntry(ctx context.Context, e sako.Entry) (sako.Entry, error)

func (*Store) AddTaggingRules

func (store *Store) AddTaggingRules(ctx context.Context, uid sako.UserID, rules []sako.TaggingRule) error

func (*Store) AddTags

func (store *Store) AddTags(ctx context.Context, uid sako.UserID, id sako.EntryID, tags ...string) error

func (*Store) AddUser

func (store *Store) AddUser(ctx context.Context, usr sako.User, pwd string) (sako.User, error)

func (*Store) Annotations

func (store *Store) Annotations(ctx context.Context, id sako.EntryID) iter.Seq2[sako.Annotation, error]

func (*Store) Close

func (store *Store) Close() error

func (*Store) DelAnnotation

func (store *Store) DelAnnotation(ctx context.Context, id sako.AnnotationID) error

func (*Store) DelEntry

func (store *Store) DelEntry(ctx context.Context, uid sako.UserID, id sako.EntryID) error

func (*Store) DelTags

func (store *Store) DelTags(ctx context.Context, uid sako.UserID, id sako.EntryID, tags ...sako.TagID) error

func (*Store) DelUser

func (store *Store) DelUser(ctx context.Context, uid sako.UserID) error

func (*Store) Do

func (store *Store) Do(ctx context.Context, f func(tx *sql.Tx) error) (err error)

func (*Store) Entries

func (store *Store) Entries(ctx context.Context, uid sako.UserID, opts ...sako.FilterOptions) iter.Seq2[sako.Entry, error]

func (*Store) GetAnnotation

func (store *Store) GetAnnotation(ctx context.Context, id sako.AnnotationID) (ann sako.Annotation, err error)

func (*Store) GetEntry

func (store *Store) GetEntry(ctx context.Context, id sako.EntryID) (sako.Entry, error)

func (*Store) GetTaggingRules

func (store *Store) GetTaggingRules(ctx context.Context, uid sako.UserID) ([]sako.TaggingRule, error)

func (*Store) GetTags

func (store *Store) GetTags(ctx context.Context, uid sako.UserID, id sako.EntryID) iter.Seq2[sako.Tag, error]

func (*Store) GetUser

func (store *Store) GetUser(ctx context.Context, name string) (sako.User, error)

func (*Store) HasEntry

func (store *Store) HasEntry(ctx context.Context, uid sako.UserID, hashURL string) (sako.EntryID, error)

func (*Store) Name

func (store *Store) Name() string

func (*Store) NumAnnotations

func (store *Store) NumAnnotations(ctx context.Context, id sako.EntryID) (n int64, err error)

func (*Store) NumEntries

func (store *Store) NumEntries(ctx context.Context, uid sako.UserID, opts ...sako.FilterOptions) (n int64, err error)

func (*Store) NumSearch added in v0.3.0

func (store *Store) NumSearch(ctx context.Context, uid sako.UserID, opts ...sako.SearchOptions) (n int64, err error)

func (*Store) NumTags

func (store *Store) NumTags(ctx context.Context, uid sako.UserID) (n int64, err error)

func (*Store) NumUsers

func (store *Store) NumUsers(ctx context.Context) (n int64, err error)

func (*Store) PutEntry

func (store *Store) PutEntry(ctx context.Context, e sako.Entry) error

func (*Store) PutTaggingRule

func (store *Store) PutTaggingRule(ctx context.Context, uid sako.UserID, rule sako.TaggingRule) error

func (*Store) Search added in v0.3.0

func (store *Store) Search(ctx context.Context, uid sako.UserID, opts ...sako.SearchOptions) iter.Seq2[sako.Entry, error]

func (*Store) Tags

func (store *Store) Tags(ctx context.Context, uid sako.UserID) iter.Seq2[sako.Tag, error]

func (*Store) Users

func (store *Store) Users(ctx context.Context) iter.Seq2[sako.User, error]

Jump to

Keyboard shortcuts

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