Documentation
¶
Index ¶
- Variables
- func CreateEdge(ctx context.Context, api *eos.API, contract, creator eos.AccountName, ...) (string, error)
- func DefaultProgressBar(prefix string, counter int) *progressbar.ProgressBar
- func EdgeExists(ctx context.Context, api *eos.API, contract eos.AccountName, ...) (bool, error)
- func EraseDocument(ctx context.Context, api *eos.API, contract eos.AccountName, ...) (string, error)
- func GetVariants() *eos.VariantDefinition
- func RemoveEdge(ctx context.Context, api *eos.API, contract eos.AccountName, ...) (string, error)
- type ContentGroup
- type ContentItem
- type ContentNotFoundError
- type Document
- func CreateDocument(ctx context.Context, api *eos.API, contract, creator eos.AccountName, ...) (Document, error)
- func GetAllDocuments(ctx context.Context, api *eos.API, contract eos.AccountName) ([]Document, error)
- func GetAllDocumentsForType(ctx context.Context, api *eos.API, contract eos.AccountName, docType string) ([]Document, error)
- func GetDocumentsWithEdge(ctx context.Context, api *eos.API, contract eos.AccountName, document Document, ...) ([]Document, error)
- func GetLastDocument(ctx context.Context, api *eos.API, contract eos.AccountName) (Document, error)
- func GetLastDocumentOfEdge(ctx context.Context, api *eos.API, contract eos.AccountName, edgeName eos.Name) (Document, error)
- func LoadDocument(ctx context.Context, api *eos.API, contract eos.AccountName, hash string) (Document, error)
- func (d *Document) GetContent(label string) (*FlexValue, error)
- func (d *Document) GetContentFromGroup(groupLabel, label string) (*FlexValue, error)
- func (d *Document) GetContentGroup(label string) (*ContentGroup, error)
- func (d *Document) GetNodeLabel() string
- func (d *Document) GetType() (eos.Name, error)
- func (d *Document) IsEqual(d2 Document) bool
- type DocumentGraph
- type Edge
- func GetAllEdges(ctx context.Context, api *eos.API, contract eos.AccountName) ([]Edge, error)
- func GetEdgesFromDocument(ctx context.Context, api *eos.API, contract eos.AccountName, document Document) ([]Edge, error)
- func GetEdgesFromDocumentWithEdge(ctx context.Context, api *eos.API, contract eos.AccountName, document Document, ...) ([]Edge, error)
- func GetEdgesToDocument(ctx context.Context, api *eos.API, contract eos.AccountName, document Document) ([]Edge, error)
- func GetEdgesToDocumentWithEdge(ctx context.Context, api *eos.API, contract eos.AccountName, document Document, ...) ([]Edge, error)
- type FlexValue
- func (fv *FlexValue) Asset() (eos.Asset, error)
- func (fv *FlexValue) Int64() (int64, error)
- func (fv *FlexValue) IsEqual(fv2 *FlexValue) bool
- func (fv *FlexValue) MarshalJSON() ([]byte, error)
- func (fv *FlexValue) Name() (eos.Name, error)
- func (fv *FlexValue) String() string
- func (fv *FlexValue) TimePoint() (eos.TimePoint, error)
- func (fv *FlexValue) UnmarshalBinary(decoder *eos.Decoder) error
- func (fv *FlexValue) UnmarshalJSON(data []byte) error
- type Graph
- type InvalidTypeError
- type Node
- type RemoveEdges
Constants ¶
This section is empty.
Variables ¶
var FlexValueVariant = eos.NewVariantDefinition([]eos.VariantType{ {Name: "monostate", Type: int64(0)}, {Name: "name", Type: eos.Name("")}, {Name: "string", Type: ""}, {Name: "asset", Type: eos.Asset{}}, {Name: "time_point", Type: eos.TimePoint(0)}, {Name: "int64", Type: int64(0)}, {Name: "checksum256", Type: eos.Checksum256([]byte("0"))}, })
FlexValueVariant may hold a name, int64, asset, string, or time_point
Functions ¶
func CreateEdge ¶
func CreateEdge(ctx context.Context, api *eos.API, contract, creator eos.AccountName, fromNode, toNode eos.Checksum256, edgeName eos.Name) (string, error)
CreateEdge creates an edge from one document node to another with the specified name
func DefaultProgressBar ¶
func EdgeExists ¶
func EdgeExists(ctx context.Context, api *eos.API, contract eos.AccountName, fromNode, toNode Document, edgeName eos.Name) (bool, error)
EdgeExists checks to see if the edge exists
func EraseDocument ¶
func EraseDocument(ctx context.Context, api *eos.API, contract eos.AccountName, hash eos.Checksum256) (string, error)
EraseDocument ...
func GetVariants ¶
func GetVariants() *eos.VariantDefinition
GetVariants returns the definition of types compatible with FlexValue
func RemoveEdge ¶
func RemoveEdge(ctx context.Context, api *eos.API, contract eos.AccountName, fromHash, toHash eos.Checksum256, edgeName eos.Name) (string, error)
RemoveEdge ...
Types ¶
type ContentGroup ¶
type ContentGroup []ContentItem
ContentGroup ...
func (*ContentGroup) GetContent ¶
func (cg *ContentGroup) GetContent(label string) (*FlexValue, error)
GetContent returns a FlexValue of the content with the matching label or an instance of ContentNotFoundError
type ContentItem ¶
ContentItem ...
func (*ContentItem) IsEqual ¶
func (c *ContentItem) IsEqual(c2 ContentItem) bool
IsEqual evalutes if the label, value type and value impl are the same
type ContentNotFoundError ¶
type ContentNotFoundError struct { Label string DocumentHash eos.Checksum256 }
ContentNotFoundError is used when content matching a specific label is requested but not found in a document
func (*ContentNotFoundError) Error ¶
func (c *ContentNotFoundError) Error() string
type Document ¶
type Document struct { ID uint64 `json:"id"` Hash eos.Checksum256 `json:"hash"` Creator eos.AccountName `json:"creator"` ContentGroups []ContentGroup `json:"content_groups"` Certificates []struct { Certifier eos.AccountName `json:"certifier"` Notes string `json:"notes"` CertificationDate eos.BlockTimestamp `json:"certification_date"` } `json:"certificates"` CreatedDate eos.BlockTimestamp `json:"created_date"` }
Document is a node in the document graph A document may hold any arbitrary, EOSIO compatible data
func CreateDocument ¶
func CreateDocument(ctx context.Context, api *eos.API, contract, creator eos.AccountName, fileName string) (Document, error)
CreateDocument creates a new document on chain from the provided file
func GetAllDocuments ¶
func GetAllDocuments(ctx context.Context, api *eos.API, contract eos.AccountName) ([]Document, error)
GetAllDocuments reads all documents and returns them in a slice
func GetAllDocumentsForType ¶
func GetAllDocumentsForType(ctx context.Context, api *eos.API, contract eos.AccountName, docType string) ([]Document, error)
GetAllDocumentsForType reads all documents and returns them in a slice
func GetDocumentsWithEdge ¶
func GetDocumentsWithEdge(ctx context.Context, api *eos.API, contract eos.AccountName, document Document, edgeName eos.Name) ([]Document, error)
GetDocumentsWithEdge retrieves a list of documents connected to the provided document via the provided edge name
func GetLastDocument ¶
GetLastDocument retrieves the last document that was created from the contract
func GetLastDocumentOfEdge ¶
func GetLastDocumentOfEdge(ctx context.Context, api *eos.API, contract eos.AccountName, edgeName eos.Name) (Document, error)
GetLastDocumentOfEdge ...
func LoadDocument ¶
func LoadDocument(ctx context.Context, api *eos.API, contract eos.AccountName, hash string) (Document, error)
LoadDocument reads a document from the blockchain and creates a Document instance
func (*Document) GetContent ¶
GetContent returns a FlexValue of the content with the matching label or an instance of ContentNotFoundError
func (*Document) GetContentFromGroup ¶
GetContentFromGroup returns a FlexValue of the content with the matching label or an instance of ContentNotFoundError
func (*Document) GetContentGroup ¶
func (d *Document) GetContentGroup(label string) (*ContentGroup, error)
GetContentGroup returns a ContentGroup matching the label or an instance of ContentNotFoundError
func (*Document) GetNodeLabel ¶
GetNodeLabel returns a string for the node label
type DocumentGraph ¶
type DocumentGraph struct {
RootNode Document
}
DocumentGraph is defined by a root node, and is aware of nodes and edges
type Edge ¶
type Edge struct { ID uint64 `json:"id"` Creator eos.Name `json:"creator"` FromNode eos.Checksum256 `json:"from_node"` ToNode eos.Checksum256 `json:"to_node"` EdgeName eos.Name `json:"edge_name"` CreatedDate eos.BlockTimestamp `json:"created_date"` }
Edge is a directional, named connection from one graph to another
func GetAllEdges ¶
GetAllEdges reads all documents and returns them in a slice
func GetEdgesFromDocument ¶
func GetEdgesFromDocument(ctx context.Context, api *eos.API, contract eos.AccountName, document Document) ([]Edge, error)
GetEdgesFromDocument retrieves a list of edges from this node to other nodes
func GetEdgesFromDocumentWithEdge ¶
func GetEdgesFromDocumentWithEdge(ctx context.Context, api *eos.API, contract eos.AccountName, document Document, edgeName eos.Name) ([]Edge, error)
GetEdgesFromDocumentWithEdge retrieves a list of edges from this node to other nodes
type FlexValue ¶
type FlexValue struct {
eos.BaseVariant
}
FlexValue may hold any of the common EOSIO types name, int64, asset, string, time_point, or checksum256
func (*FlexValue) IsEqual ¶
IsEqual evaluates if the two FlexValues have the same types and values (deep compare)
func (*FlexValue) MarshalJSON ¶
MarshalJSON translates to []byte
func (*FlexValue) UnmarshalBinary ¶
UnmarshalBinary ...
func (*FlexValue) UnmarshalJSON ¶
UnmarshalJSON translates flexValueVariant
type InvalidTypeError ¶
InvalidTypeError is used the type of a FlexValue doesn't match expectations
func (*InvalidTypeError) Error ¶
func (c *InvalidTypeError) Error() string
type Node ¶
type Node struct { OutboundEdges map[eos.Name][]*Node InboundEdges map[eos.Name][]*Node // contains filtered or unexported fields }
Node ...
type RemoveEdges ¶
type RemoveEdges struct { FromNode eos.Checksum256 `json:"from_node"` EdgeName eos.Name `json:"edge_name"` Strict bool `json:"strict"` }
RemoveEdges ...