gs

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Exactly one of O_RDONLY or O_RDWR must be specified.
	O_RDONLY int = syscall.O_RDONLY // open the sheet read-only.
	O_RDWR   int = syscall.O_RDWR   // open the sheet read-write.
	// The remaining values may be or'ed in to control behavior.
	O_CREATE int = syscall.O_CREAT // create a new sheet if none exists.
	O_EXCL   int = syscall.O_EXCL  // used with O_CREATE, sheet must not exist.
	O_TRUNC  int = syscall.O_TRUNC // truncate regular writable sheet when opened.
)

Variables

View Source
var (
	ErrInvalid  = errors.New("invalid argument")     // "invalid argument"
	ErrExist    = errors.New("sheet already exists") // "file already exists"
	ErrNotExist = errors.New("sheet does not exist") // "file does not exist"
)

Functions

func Remove

func Remove(ctx context.Context, spreadSheetId string, sheetId int32, clientCredentialsJson []byte) error

Remove removes the sheet in a given spreadspeed.

Types

type Sheet

type Sheet struct {
	io.ReadWriter
	// contains filtered or unexported fields
}

func OpenSheet

func OpenSheet(ctx context.Context, spreadSheetId string, sheetName string, flag int, clientCredentialsJson []byte) (*Sheet, error)

OpenSheet is the generalized open call. It opens the sheet with specified flag (O_RDONLY etc.). If the sheet does not exist, and the O_CREATE flag is passed, it is created. If successful, methods on the returned Sheet can be used for csv I/O.

Can also be used to check if a given file exists. To do so analysis the returned error like so errors.Is(err, gs.ErrExist).

func (*Sheet) Id

func (service *Sheet) Id() int32

Returns the ID of the sheet

func (*Sheet) Name

func (service *Sheet) Name() string

Returns the name of the Sheet

func (*Sheet) Read

func (service *Sheet) Read(p []byte) (n int, err error)

func (*Sheet) SpreadSheetId

func (service *Sheet) SpreadSheetId() string

Returns the spreadsheet ID

func (*Sheet) Write

func (service *Sheet) Write(byteData []byte) (n int, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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