Documentation ¶
Index ¶
- Constants
- type Backend
- type JSONBackend
- func (*JSONBackend) AddPublicKeys(pubKeys ...string) error
- func (jb *JSONBackend) CreateItem(i *models.Item) (*models.Item, error)
- func (jb *JSONBackend) Flush() error
- func (jb *JSONBackend) GetItemByID(id int) (*models.Item, error)
- func (jb *JSONBackend) Init(cfg *config.Config) error
- func (jb *JSONBackend) ListAllItems() ([]*models.Item, error)
- func (jb *JSONBackend) PublicKeys() ([]string, error)
- func (jb *JSONBackend) RemoveItemByID(id int) (*models.Item, error)
- func (*JSONBackend) RemovePublicKeys(pubKeys ...string) error
- func (jb *JSONBackend) UpdateItemByID(id int, i *models.Item) (*models.Item, error)
- type PublicKey
- type SqliteBackend
- func (b *SqliteBackend) AddPublicKeys(pubKeys ...string) error
- func (b *SqliteBackend) CreateItem(i *models.Item) (*models.Item, error)
- func (b *SqliteBackend) Flush() error
- func (b *SqliteBackend) GetItemByID(id int) (*models.Item, error)
- func (b *SqliteBackend) Init(cfg *config.Config) error
- func (b *SqliteBackend) ListAllItems() ([]*models.Item, error)
- func (b *SqliteBackend) PublicKeys() ([]string, error)
- func (*SqliteBackend) RemoveItemByID(id int) (*models.Item, error)
- func (*SqliteBackend) RemovePublicKeys(pubKeys ...string) error
- func (*SqliteBackend) UpdateItemByID(id int, i *models.Item) (*models.Item, error)
Constants ¶
View Source
const ( BackendJSON = "json" BackendSqlite = "sqlite3" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface { // Will be called to initialize the instance Init(cfg *config.Config) error CreateItem(i *models.Item) (*models.Item, error) ListAllItems() ([]*models.Item, error) GetItemByID(id int) (*models.Item, error) UpdateItemByID(id int, i *models.Item) (*models.Item, error) RemoveItemByID(id int) (*models.Item, error) PublicKeys() ([]string, error) AddPublicKeys(pubKeys ...string) error RemovePublicKeys(pubKeys ...string) error Flush() error }
type JSONBackend ¶
type JSONBackend struct {
// contains filtered or unexported fields
}
func (*JSONBackend) AddPublicKeys ¶
func (*JSONBackend) AddPublicKeys(pubKeys ...string) error
AddPublicKeys implements Backend
func (*JSONBackend) CreateItem ¶
CreateItem implements Backend
func (*JSONBackend) GetItemByID ¶
func (jb *JSONBackend) GetItemByID(id int) (*models.Item, error)
GetItemByID implements Backend
func (*JSONBackend) Init ¶
func (jb *JSONBackend) Init(cfg *config.Config) error
Init implements Backend
func (*JSONBackend) ListAllItems ¶
func (jb *JSONBackend) ListAllItems() ([]*models.Item, error)
ListAllItems implements Backend
func (*JSONBackend) PublicKeys ¶
func (jb *JSONBackend) PublicKeys() ([]string, error)
PublicKeys implements Backend
func (*JSONBackend) RemoveItemByID ¶
func (jb *JSONBackend) RemoveItemByID(id int) (*models.Item, error)
RemoveItemByID implements Backend
func (*JSONBackend) RemovePublicKeys ¶
func (*JSONBackend) RemovePublicKeys(pubKeys ...string) error
RemovePublicKeys implements Backend
func (*JSONBackend) UpdateItemByID ¶
UpdateItemByID implements Backend
type SqliteBackend ¶
type SqliteBackend struct {
// contains filtered or unexported fields
}
func (*SqliteBackend) AddPublicKeys ¶
func (b *SqliteBackend) AddPublicKeys(pubKeys ...string) error
AddPublicKeys implements Backend
func (*SqliteBackend) CreateItem ¶
CreateItem implements Backend
func (*SqliteBackend) GetItemByID ¶
func (b *SqliteBackend) GetItemByID(id int) (*models.Item, error)
GetItemByID implements Backend
func (*SqliteBackend) Init ¶
func (b *SqliteBackend) Init(cfg *config.Config) error
Init implements Backend
func (*SqliteBackend) ListAllItems ¶
func (b *SqliteBackend) ListAllItems() ([]*models.Item, error)
ListAllItems implements Backend
func (*SqliteBackend) PublicKeys ¶
func (b *SqliteBackend) PublicKeys() ([]string, error)
PublicKeys implements Backend
func (*SqliteBackend) RemoveItemByID ¶
func (*SqliteBackend) RemoveItemByID(id int) (*models.Item, error)
RemoveItemByID implements Backend
func (*SqliteBackend) RemovePublicKeys ¶
func (*SqliteBackend) RemovePublicKeys(pubKeys ...string) error
RemovePublicKeys implements Backend
func (*SqliteBackend) UpdateItemByID ¶
UpdateItemByID implements Backend
Click to show internal directories.
Click to hide internal directories.