db

package
v0.0.0-...-41a758e Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const DocumentSeperator string = "========================================================================\n"

Variables

This section is empty.

Functions

func GoogleApiClient

func GoogleApiClient() *http.Client

GoogleApiClient returns the configuration for authenticating to Google API

Types

type Database

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

func New

func New(docId string, ctx context.Context) *Database

func (*Database) DeleteSingleDocument

func (d *Database) DeleteSingleDocument(ctx context.Context, tab string, header string) error

Delete removes a document

func (*Database) GetSingleDocument

func (d *Database) GetSingleDocument(ctx context.Context, tab string, header string) (*DocumentResponse, error)

Get retreives the data of a document

func (*Database) SetSingleDocument

func (d *Database) SetSingleDocument(ctx context.Context, tab string, header string, content map[string]interface{}) error

Set updates a document by overriding ALL fields. To merge to an existing document, use Update. If the document does not exist, it creates a new document with the given document id

func (*Database) UpdateSingleDocument

func (d *Database) UpdateSingleDocument(ctx context.Context, tab string, header string, content map[string]interface{}) error

Update an existing document, overriding fields that exist and adding new ones

type DocumentResponse

type DocumentResponse struct {
	// The content of the document
	Content map[string]interface{}
	// The index of the first character of the document (the "I" in "Id")
	StartIndex int
	// The index of the last character of the document (excluding the seperator)
	EndIndex int
}

Jump to

Keyboard shortcuts

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