gae

package module
v0.0.0-...-f2e9bb5 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2018 License: MIT Imports: 13 Imported by: 1

README

Creating new project

see: https://github.com/noypi/clitools

Documentation

Index

Constants

View Source
const (
	ContextParam  = "context"
	LoggerParam   = "logger"
	OptsParam     = "opts"
	UseCloudParam = "use_cloud"
)
View Source
const (
	WebiContext = ContextParam
	WebiLogger  = LoggerParam
	WebiJar     = "jar"
)
View Source
const (
	StoriContext   = ContextParam
	StoriLogger    = LoggerParam
	StoriOpts      = OptsParam
	StoriProjectID = "projectID"
	StoriBucket    = "bucket"
)
View Source
const (
	DbiContext    = ContextParam
	DbiLogger     = LoggerParam
	DbiAppID      = "appid"
	DbiName       = "name" // dbi Kind
	DbiOpts       = OptsParam
	DbiUseUpdated = "use_updated"
	DbiUseCloud   = UseCloudParam
)
View Source
const (
	GAEContextKey _gaecontextKeyName = iota
)

Variables

View Source
var ErrInternalError = fmt.Errorf("Internal Error.")
View Source
var ErrNotSupported = fmt.Errorf("Not Supported.")
View Source
var (
	LocationPH, _ = time.LoadLocation("Asia/Manila")
)

Functions

func ErrInvalidParams

func ErrInvalidParams(s string) error

func GetGAEContext

func GetGAEContext(ctx context.Context) context.Context

func GetTokenSource

func GetTokenSource(ctx context.Context, jwtpath string, scopes ...string) (oauth2.TokenSource, error)

func PutGAEContext

func PutGAEContext(ctx, gaectx context.Context)

func WrapWithRemoteContext

func WrapWithRemoteContext(host string, c *http.Client) (ctx context.Context, err error)

Types

type ClientType

type ClientType int
const (
	DefaultClient ClientType = iota + 1
	StorageClient
	DatastoreClient
)

type DbExInt

type DbExInt interface {
	DbInt

	IsCloud() bool

	PutObject(k string, o interface{}) (err error)
	GetObject(k string, o interface{}) (err error)

	//-
	IsDone(error) bool
	Kind() string
	Context() context.Context
	//KindProperties() (map[string][]string, error)
	//-
	DeleteAll(ks DbiKeyArr) error
	PutAll(ks DbiKeyArr, src interface{}) error
	RunInTransaction(fn DbiTransaction, opts DbiTrxOpts) error
	CreateKey(stringID string, intID int64, parentK *DbiKey) DbiKey

	// queries
	GetRangeKeys(begink, endk string) (DbiKeyArr, error)
	GetKeysBeginsWith(begink string) (DbiKeyArr, error)
	NewQuery() DbiQuery
	Run(DbiQuery) DbiIterator
	GetAll(DbiQuery, interface{}) (DbiKeyArr, error)

	// new context
	NewContext(c context.Context) DbInt
}

type DbInt

type DbInt interface {
	Put(k string, bb []byte) (err error)
	Get(k string) (bb []byte, err error)
	Delete(k string) error
}

type DbiIterator

type DbiIterator struct {
	Cloud *cloudds.Iterator
	Local *localds.Iterator
}

func (DbiIterator) IsNil

func (o DbiIterator) IsNil() bool

func (*DbiIterator) Next

func (o *DbiIterator) Next(dst interface{}) (DbiKey, error)

type DbiKey

type DbiKey struct {
	Cloud *cloudds.Key
	Local *localds.Key
}

func (DbiKey) IntID

func (o DbiKey) IntID() (n int64)

func (DbiKey) IsNil

func (o DbiKey) IsNil() bool

func (DbiKey) StringID

func (o DbiKey) StringID() (s string)

type DbiKeyArr

type DbiKeyArr struct {
	Cloud []*cloudds.Key
	Local []*localds.Key
}

func (DbiKeyArr) Append

func (o DbiKeyArr) Append(a DbiKey) (out DbiKeyArr)

func (DbiKeyArr) AppendArr

func (o DbiKeyArr) AppendArr(a DbiKeyArr) (out DbiKeyArr)

func (DbiKeyArr) ForEach

func (o DbiKeyArr) ForEach(fn func(DbiKey) (bContinue bool))

func (DbiKeyArr) Len

func (o DbiKeyArr) Len() (n int)

func (DbiKeyArr) ToDbiKeyArray

func (o DbiKeyArr) ToDbiKeyArray() (ks []DbiKey)

func (DbiKeyArr) ToStringArray

func (o DbiKeyArr) ToStringArray() (ks []string)

type DbiQuery

type DbiQuery struct {
	Cloud *cloudds.Query
	Local *localds.Query
	C     context.Context
}

func (DbiQuery) Count

func (o DbiQuery) Count(c context.Context) (n int, err error)

func (DbiQuery) Filter

func (o DbiQuery) Filter(filterStr string, value interface{}) (q DbiQuery)

func (DbiQuery) KeysOnly

func (o DbiQuery) KeysOnly() (q DbiQuery)

func (DbiQuery) Order

func (o DbiQuery) Order(fieldName string) (q DbiQuery)

type DbiTransaction

type DbiTransaction struct {
	Cloud func(*cloudds.Transaction) error
	Local func(netcontext.Context) error
}

type DbiTrxOpts

type DbiTrxOpts struct {
	Cloud []cloudds.TransactionOption
	Local *localds.TransactionOptions
}

type LogEx

type LogEx struct {
	LogInt
}

func (LogEx) Criticalln

func (this LogEx) Criticalln(as ...interface{})

func (LogEx) Errorln

func (this LogEx) Errorln(as ...interface{})

func (LogEx) Fatalln

func (this LogEx) Fatalln(as ...interface{})

func (LogEx) Println

func (this LogEx) Println(as ...interface{})

type LogExtended

type LogExtended interface {
	LogInt
	Println(...interface{})
	Errorln(...interface{})
	Criticalln(...interface{})
	Fatalln(...interface{})
}

func ExtendLogger

func ExtendLogger(l LogInt) LogExtended

type LogInt

type LogInt interface {
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Criticalf(format string, args ...interface{})
	Email(subject, body string)
	EmailTo(ss []string, subject, body string, bHtml bool)
	SetCallDepth(n int)
	Output(calldepth int, logFn func(format string, args ...interface{}), s string)
}

type StorInt

type StorInt interface {
	Delete(fpath string) error
	Reader(fpath string) (io.ReadCloser, error)
	Writer(fpath string) (io.WriteCloser, error)
}

type Store

type Store interface {
	Get(k interface{}) (v interface{}, exists bool)
	Set(k, v interface{})
}

type Tk

type Tk interface {
	GetWebi() WebInt
	GetLogi() LogInt
	GetDbi() DbInt
	NetContext() context.Context
}

type WebInt

type WebInt interface {
	Get(url string, v *url.Values) ([]byte, error)
	Post(url string, v *url.Values) ([]byte, error)
	Client() *http.Client
}

Directories

Path Synopsis
dbi
std
kvstore
logi
std
stori
std
webi
std

Jump to

Keyboard shortcuts

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