converter

package
v0.3.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Overview

Package converter provides the converter for converting model to Protobuf, bytes and vice versa.

Index

Constants

This section is empty.

Variables

View Source
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

func BytesToObject(snapshot []byte) (*crdt.Object, error)

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

func FromChanges(pbChanges []*api.Change) ([]*change.Change, error)

FromChanges converts the given Protobuf formats to model format.

func FromClient added in v0.1.2

func FromClient(pbClient *api.Client) (*types.Client, error)

FromClient converts the given Protobuf formats to model format.

func FromClients added in v0.1.6

func FromClients(pbClients []*api.Client) ([]*types.Client, error)

FromClients converts the given Protobuf formats to model format.

func FromDocEvent added in v0.1.6

func FromDocEvent(docEvent *api.DocEvent) (*sync.DocEvent, error)

FromDocEvent converts the given Protobuf formats to model format.

func FromDocumentID added in v0.3.3

func FromDocumentID(pbID string) (types.ID, error)

FromDocumentID converts the given Protobuf formats to model format.

func FromDocumentKey added in v0.2.3

func FromDocumentKey(pbKey string) (key.Key, error)

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

func FromProject(pbProject *api.Project) (*types.Project, error)

FromProject converts the given Protobuf formats to model format.

func FromProjects added in v0.2.4

func FromProjects(pbProjects []*api.Project) ([]*types.Project, error)

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 FromUser added in v0.2.14

func FromUser(pbUser *api.User) (*types.User, error)

FromUser converts the given Protobuf formats to model format.

func ObjectToBytes

func ObjectToBytes(obj *crdt.Object) ([]byte, error)

ObjectToBytes converts the given object to byte array.

func ToChangeID added in v0.1.10

func ToChangeID(id change.ID) *api.ChangeID

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 ToChanges added in v0.2.3

func ToChanges(changes []*change.Change) ([]*api.Change, error)

ToChanges 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 ToClient added in v0.1.2

func ToClient(client types.Client) *api.Client

ToClient converts the given model to Protobuf format.

func ToClients added in v0.3.3

func ToClients(clients []types.Client) []*api.Client

ToClients converts the given model to Protobuf format.

func ToDocEvent added in v0.1.6

func ToDocEvent(docEvent sync.DocEvent) (*api.DocEvent, error)

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 ToProject added in v0.2.4

func ToProject(project *types.Project) (*api.Project, error)

ToProject converts the given model to Protobuf.

func ToProjects added in v0.2.4

func ToProjects(projects []*types.Project) ([]*api.Project, error)

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.

func ToUser added in v0.2.14

func ToUser(user *types.User) (*api.User, error)

ToUser converts the given model format to Protobuf format.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL