dsmock: github.com/timakin/dsmock Index | Files

package dsmock

import "github.com/timakin/dsmock"

Index

Package Files

const.go dsmock.go parser.go upsert.go utils.go yaml.go

Constants

const (
    KeywordKey          = "__key__"
    KeywordCurrent      = "__current__"
    KeywordNoIndex      = "__noindex__"
    KeywordNoIndexValue = "noindex"

    KeywordString   = "__string__"
    KeywordDatetime = "__datetime__"
    KeywordInteger  = "__integer__"
    KeywordInt      = "__int__"
    KeywordFloat    = "__float__"
    KeywordBoolean  = "__boolean__"
    KeywordBool     = "__bool__"
    KeywordGeo      = "__geo__"
    KeywordArray    = "__array__"
    KeywordEmbed    = "__embed__"
    KeywordBlob     = "__blob__"
    KeywordNull     = "__null__"
)
const (
    TypeString   = DatastoreType("string")
    TypeDatetime = DatastoreType("datetime")
    TypeInteger  = DatastoreType("integer")
    TypeInt      = DatastoreType("int")
    TypeFloat    = DatastoreType("float")
    TypeBoolean  = DatastoreType("boolean")
    TypeBool     = DatastoreType("bool")
    TypeKey      = DatastoreType("key")
    TypeGeo      = DatastoreType("geo")
    TypeArray    = DatastoreType("array")
    TypeEmbed    = DatastoreType("embed")
    TypeBlob     = DatastoreType("blob")
    TypeNull     = DatastoreType("null")
    TypeNil      = DatastoreType("<nil>")
)
const (
    // MaxBatchSize The number of entities per one multi upsert operation
    MaxBatchSize = 500
)

func DecodeJSON Uses

func DecodeJSON(str string, value interface{}) error

func InsertMockData Uses

func InsertMockData(ctx context.Context, filename string) error

func IsCurrentDatetime Uses

func IsCurrentDatetime(name string) bool

func IsKeyValueName Uses

func IsKeyValueName(name string) bool

func IsNoIndex Uses

func IsNoIndex(value string) bool

func KeyToString Uses

func KeyToString(k *datastore.Key) string

func ToFloat64 Uses

func ToFloat64(val interface{}) (float64, error)

func ToString Uses

func ToString(value interface{}) string

func Upsert Uses

func Upsert(ctx context.Context, filename string) error

Upsert entities form yaml file to datastore

type DatastoreType Uses

type DatastoreType string

type Default Uses

type Default map[string]interface{}

type Entity Uses

type Entity map[string]interface{}

type FileParser Uses

type FileParser interface {
    ReadFile(filename string) error
    Parse(kind string) (*[]datastore.Entity, error)
}

type KindData Uses

type KindData struct {
    Scheme   Scheme   `yaml:"scheme,omitempty"`
    Default  Default  `yaml:"default,omitempty"`
    Entities []Entity `yaml:"entities,omitempty"`
}

type Parser Uses

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

func (*Parser) ParseEntity Uses

func (p *Parser) ParseEntity(ctx context.Context, entity Entity) (dsEntity datastore.Entity, err error)

func (*Parser) Validate Uses

func (p *Parser) Validate() error

type Properties Uses

type Properties map[string]interface{}

type Scheme Uses

type Scheme struct {
    Namespace  string     `yaml:"namespace,omitempty"`
    Kind       string     `yaml:"kind,omitempty"`
    Key        string     `yaml:"key,omitempty"`
    TimeFormat string     `yaml:"time-format,omitempty"` // used for time.ParseInLocation()
    TimeLocale string     `yaml:"time-locale,omitempty"` // used for time.ParseInLocation()
    Properties Properties `yaml:"properties,omitempty"`
}

type TypeStyle Uses

type TypeStyle string

type YAMLParser Uses

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

func NewYAMLParser Uses

func NewYAMLParser() *YAMLParser

func (*YAMLParser) Parse Uses

func (p *YAMLParser) Parse(ctx context.Context) (*[]datastore.Entity, error)

func (*YAMLParser) ReadFile Uses

func (p *YAMLParser) ReadFile(filename string) error

Package dsmock imports 15 packages (graph). Updated 2018-08-13. Refresh now. Tools for package owners.