incrversion

package
v3.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteElement

func DeleteElement[E comparable](es []E, element E) []E

DeleteElement removes a specified element from a slice while maintaining the order of the slice

func DeleteElements

func DeleteElements[E comparable](es []E, toDelete []E) []E

DeleteElements removes elements from a slice that are contained in another slice, while maintaining the order of the slice

func Slice

func Slice[E any, T any](es []E, fn func(e E) T, less func(a, b T) bool) []T

Slice converts slice types in batches and sorts the resulting slice using a custom comparator

Types

type VersionSynchronizer

type VersionSynchronizer[V, R any] struct {
	Ctx                context.Context
	DB                 db_interface.VersionSyncModel
	TableName          string
	EntityID           string
	Key                func(V) string
	Local              func() ([]V, error)
	ServerVersion      func() R
	Server             func(version *model_struct.LocalVersionSync) (R, error)
	Full               func(resp R) bool
	Version            func(resp R) (string, uint64)
	Delete             func(resp R) []string
	Update             func(resp R) []V
	Insert             func(resp R) []V
	ExtraData          func(resp R) any
	ExtraDataProcessor func(ctx context.Context, data any) error
	Syncer             func(server, local []V) error
	FullSyncer         func(ctx context.Context) error
	FullID             func(ctx context.Context) ([]string, error)
	IDOrderChanged     func(resp R) bool
}

func (*VersionSynchronizer[V, R]) CheckVersionSync

func (o *VersionSynchronizer[V, R]) CheckVersionSync() error

func (*VersionSynchronizer[V, R]) Sync

func (o *VersionSynchronizer[V, R]) Sync() error

Jump to

Keyboard shortcuts

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