common

package
v0.0.0-...-e4f1321 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: GPL-2.0 Imports: 19 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MemCodec = snappyGobCodec

Functions

func AssertOkError

func AssertOkError(err error)

func GAELoggerFactory

func GAELoggerFactory(r *http.Request) common.Logger

func IsOkError

func IsOkError(err error) bool

func MemDel

func MemDel(c context.Context, keys ...string)

func MemGet

func MemGet(c context.Context, key string, val interface{})

func MemPut

func MemPut(c context.Context, key string, val interface{})

func Memoize

func Memoize(c context.Context, key string, destP interface{}, f func() interface{}) (exists bool)

func Memoize2

func Memoize2(c context.Context, super, key string, destP interface{}, f func() interface{}) (exists bool)

func MemoizeDuring

func MemoizeDuring(c context.Context, key string, dur time.Duration, cacheNil bool, destP interface{}, f func() interface{}) (exists bool)

func MemoizeMulti

func MemoizeMulti(c context.Context, keys []string, destPs []interface{}, f []func() interface{}) (exists []bool)

func MostAccepted

func MostAccepted(r *http.Request, def, name string) string

func MustDecodeKey

func MustDecodeKey(s string) (result *datastore.Key)

func MustMarshal

func MustMarshal(i interface{}) (b []byte)

func MustUnmarshal

func MustUnmarshal(b []byte, i interface{})

func SetContentType

func SetContentType(w http.ResponseWriter, t string, cache bool)

func Transaction

func Transaction(outerContext Context, f func(Context) error) error

Types

type Context

type Context struct {
	context.Context
	Req     *http.Request
	Resp    http.ResponseWriter
	Version string
	User    *user.User
	Vars    map[string]string
}

func (Context) Authenticated

func (self Context) Authenticated() bool

func (Context) DevServer

func (self Context) DevServer() bool

func (Context) RenderJSON

func (self Context) RenderJSON(i interface{})

func (Context) SetContentType

func (self Context) SetContentType(t string, cache bool)

type GAELogger

type GAELogger struct {
	context.Context
}

func (GAELogger) Printf

func (self GAELogger) Printf(f string, i ...interface{})

Jump to

Keyboard shortcuts

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