Documentation
¶
Index ¶
- type CallbackError
- type FileInfo
- type GDriver
- func (d *GDriver) Delete(path string) error
- func (d *GDriver) DeleteDirectory(path string) error
- func (d *GDriver) GetFile(path string) (*FileInfo, io.ReadCloser, error)
- func (d *GDriver) GetFileById(id string) (io.ReadCloser, error)
- func (d *GDriver) GetFileHash(path string, method HashMethod) (*FileInfo, []byte, error)
- func (d *GDriver) ListDirectory(path string, fileFunc func(*FileInfo) error) error
- func (d *GDriver) ListTrash(filePath string, fileFunc func(f *FileInfo) error) error
- func (d *GDriver) MakeDirectory(path string) (*FileInfo, error)
- func (d *GDriver) Move(oldPath, newPath string) (*FileInfo, error)
- func (d *GDriver) PutFile(filePath string, appProperties map[string]string, r io.Reader) (*FileInfo, error)
- func (d *GDriver) Rename(path string, newName string) (*FileInfo, error)
- func (d *GDriver) SetRootDirectory(path string) (*FileInfo, error)
- func (d *GDriver) Stat(path string) (*FileInfo, error)
- func (d *GDriver) Trash(path string) error
- type HashMethod
- type NotFoundError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallbackError ¶
type CallbackError struct {
NestedError error
}
CallbackError will be returned if the callback returned an error
func (CallbackError) Error ¶
func (e CallbackError) Error() string
type FileInfo ¶
type FileInfo struct {
// contains filtered or unexported fields
}
FileInfo represents file information for a file or directory
func (*FileInfo) CreationTime ¶
CreationTime returns the time when this file was created
func (*FileInfo) ModifiedTime ¶
ModifiedTime returns the time when this file was modified
func (*FileInfo) ParentPath ¶
ParentPath returns the parent path of the file or directory
type GDriver ¶
type GDriver struct {
// contains filtered or unexported fields
}
func New ¶
New creates a new Google Drive Driver, client must me an authenticated instance for google drive
func (*GDriver) Delete ¶
Delete will delete a file or directory, if directory it will also delete its descendants
func (*GDriver) DeleteDirectory ¶
DeleteDirectory will delete a directory and its descendants
func (*GDriver) GetFile ¶
GetFile gets a file and returns a ReadCloser that can consume the body of the file
func (*GDriver) GetFileById ¶
func (d *GDriver) GetFileById(id string) (io.ReadCloser, error)
GetFileById gets a file and returns a ReadCloser that can consume the body of the file
func (*GDriver) GetFileHash ¶
GetFileHash returns the hash of a file with the present method
func (*GDriver) ListDirectory ¶
ListDirectory will get all contents of a directory, calling fileFunc with the collected file information
func (*GDriver) ListTrash ¶
ListTrash lists the contents of the trash, if you specify directories it will only list the trash contents of the specified directories
func (*GDriver) MakeDirectory ¶
MakeDirectory creates a directory for the specified path, it will create non existent directores automatically
Examples:
MakeDirectory("Pictures/Holidays") // will create Pictures and Holidays
func (*GDriver) Move ¶
Move moves a file or directory to a new path, note that move also renames the target if necessary and creates non existing directories
Examples:
Move("Folder1/File1", "Folder2/File2") // File1 in Folder1 will be moved to Folder2/File2 Move("Folder1/File1", "Folder2/File1") // File1 in Folder1 will be moved to Folder2/File1
func (*GDriver) PutFile ¶
func (d *GDriver) PutFile(filePath string, appProperties map[string]string, r io.Reader) (*FileInfo, error)
PutFile uploads a file to the specified path it creates non existing directories
func (*GDriver) SetRootDirectory ¶
SetRootDirectory changes the working root directory use this if you want to do certian operations in a special directory path should always be the absolute real path
type NotFoundError ¶
type NotFoundError struct {
Path string
}
NotFoundError will be thown if an file was not found
func (NotFoundError) Error ¶
func (e NotFoundError) Error() string