Help us shape the future of Go! Take the 2026 Go Developer Survey

gdrive

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ParentID string            `json:"parentID"`
	JSONKey  ServiceAccountKey `json:"jsonKey"`
}

Config is the validated body your endpoint receives.

type Provider

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

func NewProvider

func NewProvider(cfg *Config) (*Provider, error)

func (*Provider) CreateFolder

func (g *Provider) CreateFolder(ctx context.Context, parentID *string, name string, metadata map[string]string) (*string, error)

func (*Provider) GetContent

func (g *Provider) GetContent(ctx context.Context, id string, start int64, end int64) ([]byte, error)

func (*Provider) ToTusHandler

func (g *Provider) ToTusHandler(
	storageProviderId uuid.UUID,
	basePath string,
	uploadPrefix string,
	callback types.Callback,
) (*handler.Handler, error)

type ServiceAccountKey

type ServiceAccountKey struct {
	Type                    string `json:"type"`
	ProjectID               string `json:"project_id"`
	PrivateKeyID            string `json:"private_key_id"`
	PrivateKey              string `json:"private_key"`
	ClientEmail             string `json:"client_email"`
	ClientID                string `json:"client_id"`
	AuthURI                 string `json:"auth_uri"`
	TokenURI                string `json:"token_uri"`
	AuthProviderX509CertURL string `json:"auth_provider_x509_cert_url"`
	ClientX509CertURL       string `json:"client_x509_cert_url"`
	UniverseDomain          string `json:"universe_domain"`
}

ServiceAccountKey mirrors the JSON structure of a Google service account key.

type Store

type Store struct {
	handler.DataStore
	// contains filtered or unexported fields
}

func (*Store) GetUpload

func (s *Store) GetUpload(ctx context.Context, id string) (handler.Upload, error)

func (*Store) NewUpload

func (s *Store) NewUpload(ctx context.Context, info handler.FileInfo) (handler.Upload, error)

type Upload

type Upload struct {
	handler.Upload
	// contains filtered or unexported fields
}

func (*Upload) FinishUpload

func (u *Upload) FinishUpload(ctx context.Context) error

func (*Upload) GetInfo

func (u *Upload) GetInfo(_ context.Context) (handler.FileInfo, error)

func (*Upload) GetReader

func (u *Upload) GetReader(ctx context.Context) (io.ReadCloser, error)

func (*Upload) WriteChunk

func (u *Upload) WriteChunk(ctx context.Context, offset int64, src io.Reader) (int64, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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