database

package
v0.0.0-...-e3e45df Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateUUID

func GenerateUUID() (string, error)

taken from https://play.golang.org/p/4FkNSiUDMg GenerateUUID generates a random UUID according to RFC 4122

Types

type DB

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

func New

func New(ctx context.Context, dbID string, credFile string) (db *DB,
	err error)

func (*DB) Get

func (db *DB) Get(ctx context.Context, kind Kind, id string) (
	r interface{}, err error)
func (db *DB) GetAllLinks(ctx context.Context) ([]Link, error)

func (*DB) GetMostRecentNowText

func (db *DB) GetMostRecentNowText(ctx context.Context) (*NowText, error)

func (*DB) Put

func (db *DB) Put(ctx context.Context, kind Kind, d Link) (id string,
	err error)

type Kind

type Kind string
const (
	LinkKind    Kind = "link"
	NowTextKind Kind = "nowtext"
)

func (Kind) String

func (m Kind) String() string
type Link struct {
	CreationTime time.Time `datastore:"creationTime"`
	Href         string    `datastore:"href"`
	Display      string    `datastore:"display"`
}

https://godoc.org/cloud.google.com/go/datastore

type NowText

type NowText struct {
	CreationTime  time.Time `datastore:"creationTime"`
	ProfileImgSrc string    `datastore:"profileImgSrc"`
	HTMLText      string    `datastore:"htmlText,noindex"`
}

Jump to

Keyboard shortcuts

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