Documentation ¶
Overview ¶
Package converter provides the converter for converting model to Protobuf, bytes and vice versa.
Index ¶
- Variables
- func ArrayToBytes(array *crdt.Array) ([]byte, error)
- func BytesToArray(snapshot []byte) (*crdt.Array, error)
- func BytesToObject(snapshot []byte) (*crdt.Object, error)
- func BytesToSnapshot(snapshot []byte) (*crdt.Object, *innerpresence.Map, error)
- func BytesToTree(snapshot []byte) (*crdt.Tree, error)
- func ErrorCodeOf(err error) string
- func ErrorMetadataOf(err error) map[string]string
- func FromChangePack(pbPack *api.ChangePack) (*change.Pack, error)
- func FromChanges(pbChanges []*api.Change) ([]*change.Change, error)
- func FromDocumentID(pbID string) (types.ID, error)
- func FromDocumentSummaries(pbSummaries []*api.DocumentSummary) []*types.DocumentSummary
- func FromDocumentSummary(pbSummary *api.DocumentSummary) *types.DocumentSummary
- func FromEventType(pbDocEventType api.DocEventType) (types.DocEventType, error)
- func FromOperations(pbOps []*api.Operation) ([]operations.Operation, error)
- func FromPresenceChange(pbPresenceChange *api.PresenceChange) *innerpresence.PresenceChange
- func FromProject(pbProject *api.Project) *types.Project
- func FromProjects(pbProjects []*api.Project) []*types.Project
- func FromTreeNodes(pbNodes []*api.TreeNode) (*crdt.TreeNode, error)
- func FromTreeNodesWhenEdit(pbNodes []*api.TreeNodes) ([]*crdt.TreeNode, error)
- func FromUpdatableProjectFields(pbProjectFields *api.UpdatableProjectFields) (*types.UpdatableProjectFields, error)
- func FromUser(pbUser *api.User) *types.User
- func FromVersionVector(pbVersionVector *api.VersionVector) (time.VersionVector, error)
- func ObjectToBytes(obj *crdt.Object) ([]byte, error)
- func SnapshotToBytes(obj *crdt.Object, presences map[string]innerpresence.Presence) ([]byte, error)
- func ToChangeID(id change.ID) (*api.ChangeID, error)
- func ToChangePack(pack *change.Pack) (*api.ChangePack, error)
- func ToChanges(changes []*change.Change) ([]*api.Change, error)
- func ToCheckpoint(cp change.Checkpoint) *api.Checkpoint
- func ToDocEventType(eventType types.DocEventType) (api.DocEventType, error)
- func ToDocumentSummaries(summaries []*types.DocumentSummary) []*api.DocumentSummary
- func ToDocumentSummary(summary *types.DocumentSummary) *api.DocumentSummary
- func ToOperations(ops []operations.Operation) ([]*api.Operation, error)
- func ToPresence(p innerpresence.Presence) *api.Presence
- func ToPresenceChange(p *innerpresence.PresenceChange) *api.PresenceChange
- func ToPresences(presences map[string]innerpresence.Presence) map[string]*api.Presence
- func ToProject(project *types.Project) *api.Project
- func ToProjects(projects []*types.Project) []*api.Project
- func ToTimeTicket(ticket *time.Ticket) *api.TimeTicket
- func ToTreeNodes(treeNode *crdt.TreeNode) []*api.TreeNode
- func ToTreeNodesWhenEdit(treeNodes []*crdt.TreeNode) []*api.TreeNodes
- func ToUpdatableProjectFields(fields *types.UpdatableProjectFields) (*api.UpdatableProjectFields, error)
- func ToUser(user *types.User) *api.User
- func ToVersionVector(vector time.VersionVector) (*api.VersionVector, error)
- func TreeToBytes(tree *crdt.Tree) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrPackRequired is returned when an empty pack is passed. ErrPackRequired = errors.New("pack required") // ErrCheckpointRequired is returned when a pack with an empty checkpoint is // passed. ErrCheckpointRequired = errors.New("checkpoint required") // ErrUnsupportedOperation is returned when the given operation is not // supported yet. ErrUnsupportedOperation = errors.New("unsupported operation") // ErrUnsupportedElement is returned when the given element is not // supported yet. ErrUnsupportedElement = errors.New("unsupported element") // ErrUnsupportedEventType is returned when the given event type is not // supported yet. ErrUnsupportedEventType = errors.New("unsupported event type") // ErrUnsupportedValueType is returned when the given value type is not // supported yet. ErrUnsupportedValueType = errors.New("unsupported value type") // ErrUnsupportedCounterType is returned when the given counter type is not // supported yet. ErrUnsupportedCounterType = errors.New("unsupported counter type") )
Functions ¶
func ArrayToBytes ¶ added in v0.4.9
ArrayToBytes converts the given array to byte array.
func BytesToArray ¶ added in v0.4.9
BytesToArray creates a Array from the given byte array.
func BytesToObject ¶
BytesToObject creates an Object from the given byte array.
func BytesToSnapshot ¶ added in v0.4.5
BytesToSnapshot creates a Snapshot from the given byte array.
func BytesToTree ¶ added in v0.4.0
BytesToTree creates a Tree from the given byte array.
func ErrorCodeOf ¶ added in v0.4.27
ErrorCodeOf returns the error code of the given error.
func ErrorMetadataOf ¶ added in v0.5.5
ErrorMetadataOf returns the error metadata of the given error.
func FromChangePack ¶
func FromChangePack(pbPack *api.ChangePack) (*change.Pack, error)
FromChangePack converts the given Protobuf formats to model format.
func FromChanges ¶ added in v0.2.3
FromChanges converts the given Protobuf formats to model format.
func FromDocumentID ¶ added in v0.3.3
FromDocumentID converts the given Protobuf formats to model format.
func FromDocumentSummaries ¶ added in v0.2.13
func FromDocumentSummaries(pbSummaries []*api.DocumentSummary) []*types.DocumentSummary
FromDocumentSummaries converts the given Protobuf formats to model format.
func FromDocumentSummary ¶ added in v0.2.13
func FromDocumentSummary(pbSummary *api.DocumentSummary) *types.DocumentSummary
FromDocumentSummary converts the given Protobuf formats to model format.
func FromEventType ¶
func FromEventType(pbDocEventType api.DocEventType) (types.DocEventType, error)
FromEventType converts the given Protobuf formats to model format.
func FromOperations ¶
func FromOperations(pbOps []*api.Operation) ([]operations.Operation, error)
FromOperations converts the given Protobuf formats to model format.
func FromPresenceChange ¶ added in v0.4.5
func FromPresenceChange(pbPresenceChange *api.PresenceChange) *innerpresence.PresenceChange
FromPresenceChange converts the given Protobuf formats to model format.
func FromProject ¶ added in v0.2.4
FromProject converts the given Protobuf formats to model format.
func FromProjects ¶ added in v0.2.4
FromProjects converts the given Protobuf formats to model format.
func FromTreeNodes ¶ added in v0.4.0
FromTreeNodes converts protobuf tree nodes to crdt.TreeNode. The last node in the slice is the root node, because the slice is in post-order.
func FromTreeNodesWhenEdit ¶ added in v0.4.5
FromTreeNodesWhenEdit converts protobuf tree nodes to array of crdt.TreeNode. in each element in array, the last node in slice is the root node, because the slice is in post-order.
func FromUpdatableProjectFields ¶ added in v0.2.8
func FromUpdatableProjectFields(pbProjectFields *api.UpdatableProjectFields) (*types.UpdatableProjectFields, error)
FromUpdatableProjectFields converts the given Protobuf formats to model format.
func FromVersionVector ¶ added in v0.5.3
func FromVersionVector(pbVersionVector *api.VersionVector) (time.VersionVector, error)
FromVersionVector converts the given Protobuf formats to model format.
func ObjectToBytes ¶
ObjectToBytes converts the given object to byte array.
func SnapshotToBytes ¶ added in v0.4.5
SnapshotToBytes converts the given document to byte array.
func ToChangeID ¶ added in v0.1.10
ToChangeID converts the given model format to Protobuf format.
func ToChangePack ¶
func ToChangePack(pack *change.Pack) (*api.ChangePack, error)
ToChangePack converts the given model format to Protobuf format.
func ToCheckpoint ¶ added in v0.1.10
func ToCheckpoint(cp change.Checkpoint) *api.Checkpoint
ToCheckpoint converts the given model format to Protobuf format.
func ToDocEventType ¶ added in v0.1.6
func ToDocEventType(eventType types.DocEventType) (api.DocEventType, error)
ToDocEventType converts the given model format to Protobuf format.
func ToDocumentSummaries ¶ added in v0.2.4
func ToDocumentSummaries(summaries []*types.DocumentSummary) []*api.DocumentSummary
ToDocumentSummaries converts the given model to Protobuf.
func ToDocumentSummary ¶ added in v0.2.4
func ToDocumentSummary(summary *types.DocumentSummary) *api.DocumentSummary
ToDocumentSummary converts the given model to Protobuf format.
func ToOperations ¶
func ToOperations(ops []operations.Operation) ([]*api.Operation, error)
ToOperations converts the given model format to Protobuf format.
func ToPresence ¶ added in v0.4.5
func ToPresence(p innerpresence.Presence) *api.Presence
ToPresence converts the given model to Protobuf format.
func ToPresenceChange ¶ added in v0.4.5
func ToPresenceChange(p *innerpresence.PresenceChange) *api.PresenceChange
ToPresenceChange converts the given model to Protobuf format.
func ToPresences ¶ added in v0.4.5
ToPresences converts the given model to Protobuf format.
func ToProjects ¶ added in v0.2.4
ToProjects converts the given model to Protobuf.
func ToTimeTicket ¶ added in v0.1.10
func ToTimeTicket(ticket *time.Ticket) *api.TimeTicket
ToTimeTicket converts the given model format to Protobuf format.
func ToTreeNodes ¶ added in v0.4.0
ToTreeNodes converts a TreeNode to a slice of TreeNodes in post-order traversal.
func ToTreeNodesWhenEdit ¶ added in v0.4.5
ToTreeNodesWhenEdit converts a TreeNodes to a slice of two-dimensional array of TreeNodes in post-order traversal.
func ToUpdatableProjectFields ¶ added in v0.2.8
func ToUpdatableProjectFields(fields *types.UpdatableProjectFields) (*api.UpdatableProjectFields, error)
ToUpdatableProjectFields converts the given model format to Protobuf format.
func ToVersionVector ¶ added in v0.5.3
func ToVersionVector(vector time.VersionVector) (*api.VersionVector, error)
ToVersionVector converts the given model format to Protobuf format.
Types ¶
This section is empty.