Documentation
¶
Index ¶
- type AssetType
- type Persistor
- type RelationKeyType
- type RelationType
- type SchemaGraph
- func (sg *SchemaGraph) AddAsset(assetType string) AssetType
- func (sg *SchemaGraph) AddRelation(fromType AssetType, relationType string, toType AssetType) RelationType
- func (sg *SchemaGraph) Assets() []AssetType
- func (sg *SchemaGraph) Equal(other SchemaGraph) bool
- func (sg *SchemaGraph) MarshalJSON() ([]byte, error)
- func (sg *SchemaGraph) Merge(other SchemaGraph)
- func (sg *SchemaGraph) Relations() []RelationType
- func (sg *SchemaGraph) UnmarshalJSON(b []byte) error
- type SchemaGraphJSON
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Persistor ¶
type Persistor interface { SaveSchema(ctx context.Context, sourceName string, sg SchemaGraph) error LoadSchema(ctx context.Context, sourceName string) (SchemaGraph, error) }
Persistor is a persistor of schema
type RelationType ¶
type RelationType struct { FromType AssetType `json:"from_type"` Type RelationKeyType `json:"relation_type"` ToType AssetType `json:"to_type"` }
RelationType define a relation type
type SchemaGraph ¶
SchemaGraph represent the graph of a source
func (*SchemaGraph) AddAsset ¶
func (sg *SchemaGraph) AddAsset(assetType string) AssetType
AddAsset add an asset type as a vertex in the source graph
func (*SchemaGraph) AddRelation ¶
func (sg *SchemaGraph) AddRelation(fromType AssetType, relationType string, toType AssetType) RelationType
AddRelation add a relation between asset types
func (*SchemaGraph) Assets ¶
func (sg *SchemaGraph) Assets() []AssetType
Assets return all the assets in the graph
func (*SchemaGraph) Equal ¶
func (sg *SchemaGraph) Equal(other SchemaGraph) bool
Equal check if two schema graphs are equal
func (*SchemaGraph) MarshalJSON ¶
func (sg *SchemaGraph) MarshalJSON() ([]byte, error)
MarshalJSON marshal the schema graph into json format
func (*SchemaGraph) Merge ¶
func (sg *SchemaGraph) Merge(other SchemaGraph)
Merge merge other graph into the current graph
func (*SchemaGraph) Relations ¶
func (sg *SchemaGraph) Relations() []RelationType
Relations return all the relations in the graph
func (*SchemaGraph) UnmarshalJSON ¶
func (sg *SchemaGraph) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshal the schema graph from json payload
type SchemaGraphJSON ¶
type SchemaGraphJSON struct { Vertices []AssetType `json:"vertices"` Edges []RelationType `json:"edges"` }
SchemaGraphJSON is the json representation of a schema graph
Click to show internal directories.
Click to hide internal directories.