gcache

package module
v0.0.0-...-2b629da Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2017 License: MIT Imports: 14 Imported by: 0

README

gcache

Documentation

Index

Constants

View Source
const (

	// MimeGSuiteDoc is mime-types of the document on Google Drive.
	MimeGSuiteDoc string = "application/vnd.google-apps.document"
	// MimeGSuiteFolder is mime-types of the folder on Google Drive.
	MimeGSuiteFolder string = "application/vnd.google-apps.folder"
)
View Source
const (
	// MinimumFilesField is minimim search fields on Google Drive API.
	MinimumFilesField googleapi.Field = "files/id"
)

Variables

This section is empty.

Functions

func CreateFolder

func CreateFolder(
	r *http.Request,
	file *drive.File,
) (
	string,
	error,
)

CreateFolder returns a ID of new Google Drive Folder.

func Get

func Get(
	key string,
) (
	[]byte,
	error,
)

Get returns data from cache.

func GetGDiveFolderIDs

func GetGDiveFolderIDs(
	r *http.Request,
	q string,
) (
	*map[string]string,
	error,
)

GetGDiveFolderIDs returns a map of folder IDs on Google Drive.

func GetGDriveFile

func GetGDriveFile(
	r *http.Request,
	name string,
	field googleapi.Field,
) (
	*drive.File,
	error,
)

GetGDriveFile returns a file that is a given file name on Google Drive.

func GetGDriveFileByID

func GetGDriveFileByID(
	r *http.Request,
	id string,
	field googleapi.Field,
) (
	*drive.File,
	error,
)

GetGDriveFileByID returns a file that is a given `file.Id` on Google Drive.

func GetGDriveFileContent

func GetGDriveFileContent(
	r *http.Request,
	name string,
	field googleapi.Field,
) (
	*drive.File,
	[]byte,
	error,
)

GetGDriveFileContent returns a file with content on Google Drive.

func GetGDriveService

func GetGDriveService(
	r *http.Request,
) (
	*drive.Service,
	error,
)

GetGDriveService returns the API service of Google Drive.

func GetTokenBucketGDriveAPI

func GetTokenBucketGDriveAPI() chan struct{}

GetTokenBucketGDriveAPI returns a token-bucket for calling the Google Drive API.

func IsDeadlineExceededError

func IsDeadlineExceededError(
	err error,
) bool

IsDeadlineExceededError returns is whether it is "Deadline exceeded" error or not.

func IsFileNotExportableError

func IsFileNotExportableError(
	err error,
) bool

IsFileNotExportableError returns is whether it is "fileNotExportable" error or not.

func IsInvalidSecurityTicket

func IsInvalidSecurityTicket(
	err error,
) bool

IsInvalidSecurityTicket returns is whether it is "invalid security ticket" error or not.

func IsRateLimit

func IsRateLimit(
	err error,
) bool

IsRateLimit returns is whether it is "userRateLimitExceeded" or "rateLimitExceeded" server errors or not.

func IsServerError

func IsServerError(
	err error,
) bool

IsServerError returns is whether it is 50X server errors or not.

func NewDriveFileDoesNotExistError

func NewDriveFileDoesNotExistError() error

NewDriveFileDoesNotExistError returns a DriveFileDoesNotExistError.

func SetConfig

func SetConfig(
	cid string,
	cs string,
	rt string,
)

SetConfig sets `ClientID`, `ClientSecret` and `RefreshToken` for Google OAuth2.

func SetRootFolder

func SetRootFolder(
	name string,
	permission *drive.Permission,
) error

SetRootFolder sets name and permission to a top folder on Google Drive.

func StoreGDrive

func StoreGDrive(
	r *http.Request,
	filename string,
	file *drive.File,
	payload *[]byte,
) (
	*drive.File,
	error,
)

StoreGDrive stores a file that is a given filename on Google Drive.

func StoreGDriveByID

func StoreGDriveByID(
	r *http.Request,
	id string,
	file *drive.File,
	payload *[]byte,
) (
	*drive.File,
	error,
)

StoreGDriveByID stores a file that is a given id on Google Drive.

func Triable

func Triable(
	retries int,
	err error,
) (
	bool,
	int,
	error,
)

Triable returns whether it can retry or not.

Types

type DriveFileDoesNotExistError

type DriveFileDoesNotExistError struct {
	// contains filtered or unexported fields
}

DriveFileDoesNotExistError is as HTTP response that is 40X HTTP status.

func (DriveFileDoesNotExistError) Error

func (err DriveFileDoesNotExistError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL