generated from alecodes/base-template
also refactor public and internal api to support transaction between multiple methods #2
25 lines
849 B
Go
25 lines
849 B
Go
package synchronizator
|
|
|
|
type PlatformClass interface {
|
|
// How to transform the struct into a node. It needs to return the class,
|
|
// name and a []byte representation of the metadata.
|
|
//
|
|
// - name: A user friendly name
|
|
// - metadata: Arbitrary data. This will be stored as a jsonb in the database
|
|
//
|
|
ToNode() (string, []byte, error)
|
|
|
|
// How to transform a node into the struct. This method should modify the
|
|
// struct directly as it receives a pointer.
|
|
//
|
|
// - name: A user friendly name
|
|
// - metadata: Arbitrary data. This is stored as a jsonb in the database
|
|
FromNode(string, []byte) error
|
|
}
|
|
|
|
// Utility struct to represent a collection of nodes, it's a [Node] itself so all
|
|
// the node's functionality is available.
|
|
type Platform struct {
|
|
Node // Underlaying node info
|
|
collections []*Collection // Child nodes
|
|
}
|