Documentation ¶
Index ¶
- func Contains(s []string, e string) bool
- func CreateDir(srv *drive.Service, parentId string, folderName string) (*drive.File, error)
- func CreateFile(srv *drive.Service, name string, fileToUpload *os.File, parentId string) (*drive.File, error)
- func Exists(name string) bool
- func Rename(oldPath string, path string, f os.FileInfo) error
- func SendMail(mail *Mail, f *drive.File) error
- type Config
- type Configurations
- type Connection
- type Database
- type DriveItems
- type FileSystem
- type Gdrive
- type GoogleDrive
- func (gd *GoogleDrive) GetClient(config *oauth2.Config) *http.Client
- func (gd *GoogleDrive) GetTokenFromWeb(config *oauth2.Config) *oauth2.Token
- func (gd *GoogleDrive) New() *drive.Service
- func (gd *GoogleDrive) SaveToken(path string, token *oauth2.Token)
- func (gd *GoogleDrive) TokenFromFile(file string) (*oauth2.Token, error)
- type Mail
- type Settings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateFile ¶
func CreateFile(srv *drive.Service, name string, fileToUpload *os.File, parentId string) (*drive.File, error)
createFile create file(upload) into google drive.
Types ¶
type Configurations ¶ added in v1.3.0
type Configurations interface { GetConfig([]byte, *os.File) Configurations GetPath(s *Settings) string }
Configurations defined method should implement by configuration files.
type Connection ¶
type Connection struct { Name string `yaml:"name,omitempty"` Driver string `yaml:"driver,omitempty"` Host string `yaml:"host,omitempty"` Port string `yaml:"port,omitempty"` User string `yaml:"user,omitempty"` Password string `yaml:"password,omitempty"` }
Specifying possible connection to database server later able to pick which connection can be used to export .database
type Database ¶
type Database struct { Connections []Connection Databases []Config }
type DriveItems ¶
type DriveItems struct { Folder string `yaml:"folder,omitempty"` FileSystem bool `yaml:"filesystem,omitempty"` Files []string `yaml:"files,omitempty"` DriveId string `yaml:"driveid,omitempty"` }
Google drive information that need to store into google drive.
type FileSystem ¶
type FileSystem struct {
Path []string `yaml:"path,omitempty"`
}
func (FileSystem) GetConfig ¶ added in v1.3.0
func (c FileSystem) GetConfig(buf []byte, reader *os.File) Configurations
GetConfig get the marshalling config of Filesystem configuration.
func (FileSystem) GetPath ¶ added in v1.3.0
func (c FileSystem) GetPath(s *Settings) string
GetPath get the filesystem configuration file path.
type Gdrive ¶
type Gdrive struct {
Config []DriveItems
}
type GoogleDrive ¶
type GoogleDrive struct { drive.Service CredentialDirPath string }
func (*GoogleDrive) GetClient ¶
func (gd *GoogleDrive) GetClient(config *oauth2.Config) *http.Client
Retrieve a token, saves the token, then returns the generated client.
func (*GoogleDrive) GetTokenFromWeb ¶
func (gd *GoogleDrive) GetTokenFromWeb(config *oauth2.Config) *oauth2.Token
Request a token from the web, then returns the retrieved token.
func (*GoogleDrive) SaveToken ¶
func (gd *GoogleDrive) SaveToken(path string, token *oauth2.Token)
Saves a token to a file path.
func (*GoogleDrive) TokenFromFile ¶
func (gd *GoogleDrive) TokenFromFile(file string) (*oauth2.Token, error)
Retrieves a token from a local file.
type Mail ¶ added in v1.3.0
type Mail struct { From string `yaml:"from,omitempty"` To string `yaml:"to,omitempty"` Host string `yaml:"host,omitempty"` Port string `yaml:"port,omitempty"` Username string `yaml:"username,omitempty"` Password string `yaml:"password,omitempty"` Encryption string `yaml:"encryption,omitempty"` }
type Settings ¶ added in v1.1.0
type Settings struct { GdrivePath string DatabasePath string FilesystemPath string ConfigPath string MailPath string }
Define all configurations path.
func (*Settings) ConstructPath ¶ added in v1.1.0
func (s *Settings) ConstructPath()
ConstructPath replace user defined path for all existing configurations path
func (*Settings) GetConfig ¶ added in v1.3.0
func (s *Settings) GetConfig(c Configurations) (Configurations, error)
GetConfig react as layer to get implemented configurations.