Documentation
¶
Overview ¶
Package dtentity provides JSON encode/decode for *datatug.Entity that correctly round-trips Tables (the "generated mapping copy") - see TableKeyDoc for why the model's own JSON tags can't do this in datatug-core v0.17.0. This is unrelated to and does not paper over the separate, tracked datatug-core filestore entities layout bug (S27); it only fixes how this CLI parses/renders the "tables" YAML/JSON section it itself authors and displays.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalEntity ¶
MarshalEntity encodes entity to indented JSON, correctly including Tables (see UnmarshalEntity). Re-marshals through a map, so key order is alphabetical rather than following the struct's field declaration order.
Types ¶
type TableKeyDoc ¶
type TableKeyDoc struct {
Name string `json:"name"`
Schema string `json:"schema,omitempty"`
Catalog string `json:"catalog,omitempty"`
}
TableKeyDoc is the JSON/YAML shape a table/mapping-copy reference is authored or rendered as: {name, schema, catalog}. datatug-core v0.17.0's datatug.DBCollectionKey (embedded in datatug.TableKeys, i.e. datatug.Entity.Tables - the "generated mapping copy") made its identity fields unexported - Name()/Schema()/Catalog() methods backed by a dal.CollectionRef, instead of exported string fields - so it has no exported fields or MarshalJSON/UnmarshalJSON encoding/json can use. Confirmed: a generic json.Marshal of a populated Entity.Tables renders as `{"Ref":{}}` per key, and json.Unmarshal of authored {"name":...} JSON leaves DBCollectionKey entirely zero-valued. MarshalEntity/UnmarshalEntity bridge this with the module's own public NewTableKey constructor and Name()/Schema()/Catalog() accessors - not a fork of the type, just correct use of its actual (methods-based) public API instead of relying on encoding/json reflection, which v0.17.0 no longer supports for it.