Documentation ¶
Index ¶
- func Export(it *datastore.Iterator, w io.Writer) (err error)
- func Import(r io.Reader, ds *datastore.Client) (err error)
- func ImportFile(r io.Reader, outCh chan Entity, errCh chan error) (err error)
- func ImportFileReflect(filename string, modelMap []ModelMapping) error
- func ImportStreamReflect(r io.Reader, modelMap []ModelMapping) (err error)
- func Marshal(inCh <-chan Entity, outCh chan<- []byte, errCh chan<- error)
- func MarshalKey(key *datastore.Key) string
- func OpenForReading(filename string) (io.ReadCloser, error)
- func OpenForWriting(filename string) (io.WriteCloser, error)
- func Unmarshal(inCh <-chan []byte, outCh chan<- Entity, errCh chan<- error)
- func UnmarshalKey(s string) (key *datastore.Key)
- type Entity
- type ImportFuncType
- type ModelMapping
- type Reflector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ImportFile ¶ added in v0.2.1
ImportFile reads an export file, writing DataStore entities to outCh. Closes outCh to signal EOF. Waits until errCh is closed. Returns the first encountered error.
func ImportFileReflect ¶ added in v0.6.0
func ImportFileReflect(filename string, modelMap []ModelMapping) error
ImportFileReflect imports a given .ds file using the provided type and import function.
func ImportStreamReflect ¶ added in v0.6.0
func ImportStreamReflect(r io.Reader, modelMap []ModelMapping) (err error)
ImportStreamReflect imports a given .ds stream using the provided type and import function mapping
func MarshalKey ¶
func OpenForReading ¶ added in v1.1.0
func OpenForReading(filename string) (io.ReadCloser, error)
OpenForReading opens a file for reading, seamlessly un-gzipping if needed.
func OpenForWriting ¶ added in v1.1.0
func OpenForWriting(filename string) (io.WriteCloser, error)
OpenForWriting opens a file for writing, seamlessly gzipping if needed.
func Unmarshal ¶
Unmarshal processes export file lines, writing DataStore entities to outCh and any error to errCh. Closes outCh and errCh before returning.
func UnmarshalKey ¶
Types ¶
type Entity ¶
type Entity struct { Key *datastore.Key Properties datastore.PropertyList }
Entity wraps a DataStore entity including its key and all properties as key-value pairs.
type ImportFuncType ¶ added in v0.6.0
ImportFuncType is the type of the import callback.
type ModelMapping ¶ added in v0.7.0
type ModelMapping struct { // DataStore entity kind (type name). Kind string // TypePtr must be a pointer to a struct of the desired type. TypePtr interface{} // ImportFunc will be called with a slice of pointers to objects of the given type. ImportFunc ImportFuncType // BatchSize defines the desired number of elements for a single ImportFunc call. BatchSize int }
ModelMapping wraps a single data model type.
type Reflector ¶ added in v0.6.0
type Reflector struct {
// contains filtered or unexported fields
}
Reflector implements a caching reflection helper.
func NewReflector ¶ added in v0.6.0
func NewReflector(typePtr interface{}) *Reflector
NewReflector returns a new instance of Reflector. Typical use-case flow: r.Reset(), r.Set(), r.Set() ..., r.MakeCopy()
func (*Reflector) MakeCopy ¶ added in v0.6.0
func (r *Reflector) MakeCopy() interface{}
MakeCopy returns a pointer to a copy of the reflected object.