Documentation ¶
Index ¶
- func IsExist(e error) bool
- func IsNotExist(e error) bool
- type CallbackError
- type File
- type FileExistError
- type FileInfo
- type FileIsDirectoryError
- type FileIsNotDirectoryError
- type FileNotExistError
- 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) 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) Open(path string, flag OpenFlag) (File, error)
- func (d *GDriver) PutFile(filePath 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 OpenFlag
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNotExist ¶
IsNotExist returns true if the error is an FileNotExistError
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 FileExistError ¶
type FileExistError struct {
Path string
}
FileExistError will be thrown if an file exists
func (FileExistError) Error ¶
func (e FileExistError) 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 FileIsDirectoryError ¶
type FileIsDirectoryError struct {
Path string
}
FileIsDirectoryError will be thrown if a file is a directory
func (FileIsDirectoryError) Error ¶
func (e FileIsDirectoryError) Error() string
type FileIsNotDirectoryError ¶
type FileIsNotDirectoryError struct {
Path string
}
FileIsNotDirectoryError will be thrown if a file is not a directory
func (FileIsNotDirectoryError) Error ¶
func (e FileIsNotDirectoryError) Error() string
type FileNotExistError ¶
type FileNotExistError struct {
Path string
}
FileNotExistError will be thrown if an file was not found
func (FileNotExistError) Error ¶
func (e FileNotExistError) Error() string
type GDriver ¶
type GDriver struct {
// contains filtered or unexported fields
}
GDriver can be used to access google drive in a traditional file-folder-path pattern
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) 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 ¶
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 HashMethod ¶
type HashMethod int
HashMethod is the hashing method to use for GetFileHash
const ( // HashMethodMD5 sets the method to MD5 HashMethodMD5 HashMethod = 0 )