store

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var INVITES = []byte("_invites")
View Source
var USERS = []byte("_users")

Functions

func Read

func Read(c *bolt.Cursor, option SelectOptions) map[string][]byte

func Select

func Select(s *Store, bucketName []byte) func(...SelectOptions) (map[string][]byte, error)

func SendInvite added in v0.1.1

func SendInvite(url string, invite *model.Invite) error

Types

type IInvite added in v0.1.1

type IInvite interface {
	GetUUID() []byte
	GetEmail() string
	IsExpired() bool
}

type IUser added in v0.1.1

type IUser interface {
	ToBytes() []byte
	GetName() string
	SetCreated()
	SetUpdated()
}

type SelectOptions

type SelectOptions struct {
	Limit   *int
	Offset  *int
	Prefix  *string
	Value   *string
	Reverse bool
}

func NewSelectOptions

func NewSelectOptions() *SelectOptions

func (*SelectOptions) FromQuery

func (Opt *SelectOptions) FromQuery(values url.Values) *SelectOptions

func (*SelectOptions) IsLimit

func (Opt *SelectOptions) IsLimit() (r bool)

func (*SelectOptions) IsOffset

func (Opt *SelectOptions) IsOffset() (r bool)

func (*SelectOptions) IsValue added in v0.0.12

func (Opt *SelectOptions) IsValue(v []byte) bool

func (*SelectOptions) SetLimit

func (Opt *SelectOptions) SetLimit(limit *int) *SelectOptions

func (*SelectOptions) SetOffset

func (Opt *SelectOptions) SetOffset(Offset *int) *SelectOptions

func (*SelectOptions) SetPrefix added in v0.0.12

func (Opt *SelectOptions) SetPrefix(prefix *string) *SelectOptions

func (*SelectOptions) SetValue added in v0.0.12

func (Opt *SelectOptions) SetValue(value *string) *SelectOptions

type Store

type Store struct {
	Filename string
	DB       *bolt.DB
	Index    bleve.Index
}

func NewStoreBDB

func NewStoreBDB(filename string) (store *Store, err error)

func (Store) Close

func (s Store) Close() error

func (*Store) CreateOrUpdateInvite added in v0.1.1

func (s *Store) CreateOrUpdateInvite(email string) (invite *model.Invite, err error)

func (Store) CreateUser added in v0.1.1

func (s Store) CreateUser(user IUser) error

func (*Store) DeleteInvite added in v0.1.1

func (s *Store) DeleteInvite(invite IInvite) error

func (Store) FirstUser

func (s Store) FirstUser() error

func (*Store) GetInvite added in v0.1.1

func (s *Store) GetInvite(key string) (*model.Invite, error)

func (Store) GetUser

func (s Store) GetUser(username string, user interface{}) (err error)

func (*Store) InviteToUser added in v0.1.1

func (s *Store) InviteToUser(key string, user IUser) error

func (Store) RmBucket

func (s Store) RmBucket(name []string) error

func (Store) RmBucketItem added in v0.0.8

func (s Store) RmBucketItem(bucketName []byte, key []byte) error

Jump to

Keyboard shortcuts

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