Documentation ¶
Overview ¶
Package converter provides the converter for converting model to Protobuf, bytes and vice versa.
Index ¶
- Variables
- func BytesToObject(snapshot []byte) (*crdt.Object, error)
- func FromChangePack(pbPack *api.ChangePack) (*change.Pack, error)
- func FromChanges(pbChanges []*api.Change) ([]*change.Change, error)
- func FromClient(pbClient *api.Client) (*types.Client, error)
- func FromClients(pbClients []*api.Client) ([]*types.Client, error)
- func FromDocEvent(docEvent *api.DocEvent) (*sync.DocEvent, error)
- func FromDocumentID(pbID string) (types.ID, error)
- func FromDocumentKey(pbKey string) (key.Key, error)
- func FromDocumentSummaries(pbSummaries []*api.DocumentSummary) ([]*types.DocumentSummary, error)
- func FromDocumentSummary(pbSummary *api.DocumentSummary) (*types.DocumentSummary, error)
- func FromEventType(pbDocEventType api.DocEventType) (types.DocEventType, error)
- func FromOperations(pbOps []*api.Operation) ([]operations.Operation, error)
- func FromPresenceInfo(pbPresence *api.Presence) types.PresenceInfo
- func FromProject(pbProject *api.Project) (*types.Project, error)
- func FromProjects(pbProjects []*api.Project) ([]*types.Project, error)
- func FromUpdatableProjectFields(pbProjectFields *api.UpdatableProjectFields) (*types.UpdatableProjectFields, error)
- func FromUser(pbUser *api.User) (*types.User, error)
- func ObjectToBytes(obj *crdt.Object) ([]byte, error)
- func ToChangeID(id change.ID) *api.ChangeID
- func ToChangePack(pack *change.Pack) (*api.ChangePack, error)
- func ToChanges(changes []*change.Change) ([]*api.Change, error)
- func ToCheckpoint(cp change.Checkpoint) *api.Checkpoint
- func ToClient(client types.Client) *api.Client
- func ToClients(clients []types.Client) []*api.Client
- func ToDocEvent(docEvent sync.DocEvent) (*api.DocEvent, error)
- func ToDocEventType(eventType types.DocEventType) (api.DocEventType, error)
- func ToDocumentSummaries(summaries []*types.DocumentSummary) ([]*api.DocumentSummary, error)
- func ToDocumentSummary(summary *types.DocumentSummary) (*api.DocumentSummary, error)
- func ToOperations(ops []operations.Operation) ([]*api.Operation, error)
- func ToPresenceInfo(info types.PresenceInfo) *api.Presence
- func ToProject(project *types.Project) (*api.Project, error)
- func ToProjects(projects []*types.Project) ([]*api.Project, error)
- func ToTimeTicket(ticket *time.Ticket) *api.TimeTicket
- func ToUpdatableProjectFields(fields *types.UpdatableProjectFields) (*api.UpdatableProjectFields, error)
- func ToUser(user *types.User) (*api.User, 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 BytesToObject ¶
BytesToObject creates an Object from the given byte array.
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 FromClient ¶ added in v0.1.2
FromClient converts the given Protobuf formats to model format.
func FromClients ¶ added in v0.1.6
FromClients converts the given Protobuf formats to model format.
func FromDocEvent ¶ added in v0.1.6
FromDocEvent 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 FromDocumentKey ¶ added in v0.2.3
FromDocumentKey converts the given Protobuf formats to model format.
func FromDocumentSummaries ¶ added in v0.2.13
func FromDocumentSummaries(pbSummaries []*api.DocumentSummary) ([]*types.DocumentSummary, error)
FromDocumentSummaries converts the given Protobuf formats to model format.
func FromDocumentSummary ¶ added in v0.2.13
func FromDocumentSummary(pbSummary *api.DocumentSummary) (*types.DocumentSummary, error)
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 FromPresenceInfo ¶ added in v0.2.4
func FromPresenceInfo(pbPresence *api.Presence) types.PresenceInfo
FromPresenceInfo 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 FromUpdatableProjectFields ¶ added in v0.2.8
func FromUpdatableProjectFields(pbProjectFields *api.UpdatableProjectFields) (*types.UpdatableProjectFields, error)
FromUpdatableProjectFields converts the given Protobuf formats to model format.
func ObjectToBytes ¶
ObjectToBytes converts the given object 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 ToDocEvent ¶ added in v0.1.6
ToDocEvent converts the given model 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, error)
ToDocumentSummaries converts the given model to Protobuf.
func ToDocumentSummary ¶ added in v0.2.4
func ToDocumentSummary(summary *types.DocumentSummary) (*api.DocumentSummary, error)
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 ToPresenceInfo ¶ added in v0.2.4
func ToPresenceInfo(info types.PresenceInfo) *api.Presence
ToPresenceInfo 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 ToUpdatableProjectFields ¶ added in v0.2.8
func ToUpdatableProjectFields(fields *types.UpdatableProjectFields) (*api.UpdatableProjectFields, error)
ToUpdatableProjectFields converts the given model format to Protobuf format.
Types ¶
This section is empty.