dtentity

package
v0.39.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

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

func MarshalEntity(entity *datatug.Entity) ([]byte, error)

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.

func UnmarshalEntity

func UnmarshalEntity(data []byte) (*datatug.Entity, error)

UnmarshalEntity decodes JSON into a *datatug.Entity, additionally populating Tables - see the TableKeyDoc doc comment for why that can't happen through *datatug.Entity's own JSON tags in datatug-core v0.17.0.

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.

Jump to

Keyboard shortcuts

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