Documentation ¶
Index ¶
- func DoReadJoin(ctx context.Context, client *datamanclient.Client, q *query.Query, ...) error
- func DoReadJoins(ctx context.Context, client *datamanclient.Client, q *query.Query, ...) error
- func NormalizeJoinMap(n string, m JoinMap)
- func SortJoinFieldList(l []string)
- func SplitJoinFieldsString(collectionName string, joinMap JoinMap) ([]string, []string)
- type Collection
- type CollectionGetter
- type ForwardJoin
- type JoinMap
- type MetaCollection
- type ReverseJoin
- type WriteJoinSubrecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoReadJoin ¶
func DoReadJoin(ctx context.Context, client *datamanclient.Client, q *query.Query, joinCollection *Collection, record record.Record) error
TODO: reimplement to do records at once -- so we can batch?
func DoReadJoins ¶
func DoReadJoins(ctx context.Context, client *datamanclient.Client, q *query.Query, meta *metadata.Meta, collection *metadata.Collection, joinField interface{}, records []record.Record) error
TODO: change this to have a flag on whether to stop on error or continue (or maybe switch to channels for the error? then we can decide either way
func NormalizeJoinMap ¶
func SortJoinFieldList ¶
func SortJoinFieldList(l []string)
Types ¶
type Collection ¶
type Collection struct { // A pointer to us-- so we can do things like find fields etc. M MetaCollection `json:"-"` Name string `json:"name"` ForwardJoin []*ForwardJoin `json:"forward_join,omitempty"` // There can be N reverse ones ReverseJoin []*ReverseJoin `json:"reverse_join,omitempty"` }
Represent a collection in the join state
func NewCollection ¶
func NewCollection(m MetaCollection) *Collection
func OrderJoins ¶
func OrderJoins(collectionMetaGetter CollectionGetter, collection MetaCollection, joinMap JoinMap) (*Collection, error)
Return a list of join steps. These can be run in chains
func (*Collection) HasJoins ¶
func (c *Collection) HasJoins() bool
type CollectionGetter ¶
type CollectionGetter func(name string) (MetaCollection, error)
type ForwardJoin ¶
type ForwardJoin struct { Key string `json:"key"` C *Collection `json:"c"` JoinField *metadata.CollectionField `json:"join_field"` Filter map[string]interface{} `json:"filter"` }
type MetaCollection ¶
type MetaCollection interface { GetName() string GetFieldByName(name string) *metadata.CollectionField GetField(nameParts []string) *metadata.CollectionField }
Since router and storage_node have different collections we need an interface which is common)
type ReverseJoin ¶
type ReverseJoin struct { Key string `json:"key"` C *Collection `json:"c"` JoinField *metadata.CollectionField `json:"join_field"` Filter map[string]interface{} `json:"filter"` }
type WriteJoinSubrecord ¶
type WriteJoinSubrecord struct { Path []string Value interface{} }
Struct to encapsulate returns of writes from subrecords done
func DoWriteJoin ¶
func DoWriteJoin(ctx context.Context, client *datamanclient.Client, q *query.Query, joinCollection *Collection, record record.Record) ([]*WriteJoinSubrecord, error, error)
func DoWriteJoins ¶
func DoWriteJoins(ctx context.Context, client *datamanclient.Client, q *query.Query, meta *metadata.Meta, collection *metadata.Collection, joinField interface{}, record record.Record) ([]*WriteJoinSubrecord, error, error)
TODO: change this to have a flag on whether to stop on error or continue (or maybe switch to channels for the error? then we can decide either way return map[path]subrecord validationError, error
func (*WriteJoinSubrecord) Apply ¶
func (w *WriteJoinSubrecord) Apply(record record.Record)