Documentation
¶
Overview ¶
Package storage is used to handle persistence.
Index ¶
Constants ¶
View Source
const ( // ConfKeyFilePath represents the password db path key in the conf map. ConfKeyFilePath = "CONF_KEY_FILE_PATH" // ConfKeyFilePermission represents the password db file permission key in the conf map. ConfKeyFilePermission = "CONF_KEY_FILE_PERMISSION" // FilePermissionPattern represents the password db file permission regex. FilePermissionPattern = "[0,2,4,6][0-7][0-7][0-7]" // FileStorageID is the File storage type ID. FileStorageID = "File" )
View Source
const ( // GoogleDriveStorageID is the File storage type ID. GoogleDriveStorageID = "GoogleDrive" // ConfKeyTokenFilePath represents the token file path in the conf map. ConfKeyTokenFilePath = "CONF_KEY_TOKEN_FILE_PATH" // ConfKeyDirectory represents the password file directory in the conf map. ConfKeyDirectory = "CONF_KEY_DIRECTORY" // ConfKeyPasswordDBFile represents the password Database file name in the conf map. ConfKeyPasswordDBFile = "CONF_KEY_PASSWORD_DB_FILE" )
Variables ¶
View Source
var ( // ErrInvalidPermission represents an invalid permission error. ErrInvalidPermission = func(p string) error { return errors.New(fmt.Sprintf("invalid permission: %s", p)) } // ErrUnableToConfigure represents unable to configure file storage error. ErrUnableToConfigure = func(e error) error { return errors.Wrap(e, "unable to configure storage") } )
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File represent a file as a storage.
func (*File) InitForFirstTime ¶
InitForFirstTime initialises the file storage for the first time.
type GoogleDrive ¶
type GoogleDrive struct {
// contains filtered or unexported fields
}
GoogleDrive represent a GoogleDrive as a storage.
func (*GoogleDrive) Init ¶
func (g *GoogleDrive) Init(conf map[string]string) error
Init initialises the storage. After "InitForFirstTime" method, this function can be called to initialize the GoogleDrive storage in the consequent uses.
func (*GoogleDrive) InitForFirstTime ¶
func (g *GoogleDrive) InitForFirstTime(data []byte, conf map[string]string) error
InitForFirstTime initialises the GoogleDrive storage for the first time.
func (*GoogleDrive) Load ¶
func (g *GoogleDrive) Load() ([]byte, error)
Load loads the GoogleDrive storage as a byte array.
func (*GoogleDrive) Store ¶
func (g *GoogleDrive) Store(data []byte) error
Store store data in the GoogleDrive storage.
type Storage ¶
type Storage interface { // InitForFirstTime initialises the storage for the first time. InitForFirstTime(data []byte, conf map[string]string) error // Init initialises the storage. // After "InitForFirstTime" method, this function can be called to initialize the storage in the consequent uses. Init(conf map[string]string) error // Load loads the storage as a byte array. Load() ([]byte, error) // Store store data in the storage. Store(data []byte) error }
Storage interface is used to store data.
Directories
¶
Path | Synopsis |
---|---|
Package googledrive holds the implementation related to Drive interactions.
|
Package googledrive holds the implementation related to Drive interactions. |
Click to show internal directories.
Click to hide internal directories.