Documentation
¶
Index ¶
- type ErrEntryAlreadyExists
- type ErrEntryDoesntExist
- type ErrStoreDecrypted
- type ErrStoreEncrypted
- type Store
- func (s *Store) Attach(path, attachmentPath string) error
- func (s *Store) Collection() (*entries.Collection, error)
- func (s *Store) Create(path, content string) error
- func (s *Store) Decrypt(passwordFunc func() (string, error)) error
- func (s *Store) Delete(path string) error
- func (s *Store) DisableGit()
- func (s *Store) Encrypt() error
- func (s *Store) Encrypted() (bool, error)
- func (s *Store) Update(path, content string) error
- func (s *Store) UsingGit() bool
- Bugs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrEntryAlreadyExists ¶
type ErrEntryAlreadyExists struct {
Path string
}
ErrEntryAlreadyExists is returned when the entry requested already exists.
func (ErrEntryAlreadyExists) Error ¶
func (e ErrEntryAlreadyExists) Error() string
Error returns the error message.
type ErrEntryDoesntExist ¶
type ErrEntryDoesntExist struct {
Path string
}
ErrEntryDoesntExist is returned when the entry requested doesn't exist.
func (ErrEntryDoesntExist) Error ¶
func (e ErrEntryDoesntExist) Error() string
Error returns the error message.
type ErrStoreDecrypted ¶
type ErrStoreDecrypted struct {
Path string
}
ErrStoreDecrypted is returned when a store is asked to be decrypted but it's already decrypted.
func (ErrStoreDecrypted) Error ¶
func (e ErrStoreDecrypted) Error() string
Error returns the error message.
type ErrStoreEncrypted ¶
type ErrStoreEncrypted struct {
Path string
}
ErrStoreEncrypted is returned when an action is attempted that requires a decrypted store but the store is decrypted.
func (ErrStoreEncrypted) Error ¶
func (e ErrStoreEncrypted) Error() string
Error returns the error message.
type Store ¶
type Store struct { Path string // contains filtered or unexported fields }
Store represents an Albatross store.
func (*Store) Attach ¶
Attach attaches a file to an entry by copying it into the entry's folder from the location specified. If the store is encrypted, it will return ErrStoreEncrypted.
func (*Store) Collection ¶
func (s *Store) Collection() (*entries.Collection, error)
Collection returns the *entries.Collection for the store. It will give an error if the store is currently encrypted.
func (*Store) Create ¶
Create creates a new entry in the store. If the store is encrypted, it returns ErrStoreEncrypted. It takes a path relative to the entries folder, such as "food/pizza" and it will create intermediate directories.
func (*Store) Decrypt ¶
Decrypt decrypts the store. If the store is already decrypted, it will return ErrStoreDecrypted. It takes a password func, which is anything that returns a string and an error. This allows to specify the password without having to hard code it in.
func (*Store) Delete ¶
Delete deletes an entry and all its attachments from the store. If the store is encrypted, it returns ErrStoreEncrypted. It takes a path relative to the entries folder, such as "food/pizza". The path given has to be an entry itself, this function cannot be used to delete whole folders of entries. If the entry given has subdirectories of entries itself, those subdirectories will be left intact. BUG(ollybritton): This code won't delete attachments if they're in a folder next to the entry. The code needs to recursively search all subdirectories to determine if they're folders or not.
func (*Store) DisableGit ¶
func (s *Store) DisableGit()
DisableGit disables the use of git. Calling .UsingGit will still return true. The reasoning is that the store is still using Git, it's just Git functionality isn't being used by the client.
func (*Store) Encrypt ¶
Encrypt encrypts the store. If the store is already encrypted, it returns ErrStoreEncrypted.
func (*Store) Encrypted ¶
Encrypted returns true or false depending on whether the store is encrypted or decrypted.
func (*Store) Update ¶
Update updates the given entry. If the store is encrypted, it returns ErrStoreEncrypted.
Notes ¶
Bugs ¶
This code won't delete attachments if they're in a folder next to the entry. The code needs to recursively search all subdirectories to determine if they're folders or not.