context

package
v0.0.0-...-0e3259e Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2020 License: MIT Imports: 6 Imported by: 2

Documentation

Overview

Package context "Every package should have a package comment, a block comment preceding the package clause. For multi-file packages, the package comment only needs to be present in one file, and any one will do. The package comment should introduce the package and provide information relevant to the package as a whole. It will appear first on the godoc page and should set up the detailed documentation that follows."

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteMulti

func DeleteMulti(ctx context.Context, ekx []string) error

DeleteMulti removes the entities and all the corresponding pageContext entities by the provided encoded keys also returns an error.

Types

type Context

type Context struct {
	ID           string            `datastore:"-"`
	Value        string            `datastore:"-" json:"value"`
	ValuesBS     []byte            `json:"-"`
	Values       map[string]string `datastore:"-" json:"values"`
	Created      time.Time         `json:"created"`
	LastModified time.Time         `json:"lastModified"`
	PageIDs      []string          `datastore:"-" json:"pageIDs"`
}

Context is the struct to store application contexts for pages with different languages. And returns only the requested language as Value. datastore: ",noindex" causes json naming problems !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Key's "StringID" is a fraction of the context's english value([en-US]). Useful for some cases like user's isAdmin() check.

type Contexts

type Contexts map[string]*Context

Contexts is map[string]*Context.

func AddMulti

func AddMulti(ctx context.Context, cx []*Context) (Contexts, error)

AddMulti creates and puts corresponding PageContexts and then puts newly created Contexts. Also, returns new Contexts and an error.

func AddMultiAndGetNextLimited

func AddMultiAndGetNextLimited(ctx context.Context, crsrAsString string, cx []*Context) (
	Contexts, string, error)

AddMultiAndGetNextLimited is a transaction which puts the posted entities first and then gets entities from the reseted cursor by the given limit. Finally returnes received entities with posted entities added to them as a map.

func GetNextLimited

func GetNextLimited(ctx context.Context, crsrAsString string, lim int) (
	Contexts, string, error)

GetNextLimited returns limited entitities within an order after the given cursor. If limit is 0 or greater than 40, default limit will be used.

func UpdateMulti

func UpdateMulti(ctx context.Context, cx []*Context) (Contexts, error)

UpdateMulti is a transaction that delets all PageContext entities for corresponding context and then creates and puts new ones. Finally, puts modified Contexts and returns nil map and an error.

Jump to

Keyboard shortcuts

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