Versions in this module Expand all Collapse all v1 v1.0.0 Jul 2, 2025 Changes in this version + var ErrDuplicateKey = errors.New("duplicate key") + var ErrKeyNotFound = errors.New("key not found") + var ErrQuotaExceeded = errors.New("quota exceeded") + var ErrSyncFailed = errors.New("sync failed") + func MergeSchemas(current, sheet []string) []string + func ValidateQuery(query Query) error + type Adapter interface + BatchUpdate func(ctx context.Context, operations []Operation) error + Load func(ctx context.Context) ([]*Record, []string, error) + Save func(ctx context.Context, records []*Record, schema []string, strategy SyncStrategy) error + type Cache struct + func NewCache() *Cache + func (c *Cache) Append(record *Record) error + func (c *Cache) Clear() + func (c *Cache) ClearDirty() + func (c *Cache) Delete(key int) error + func (c *Cache) Get(key int) (*Record, error) + func (c *Cache) GetAllRecords() []*Record + func (c *Cache) GetDirtyKeys() []int + func (c *Cache) GetSchema() []string + func (c *Cache) Load(records []*Record, schema []string) + func (c *Cache) Query(query Query) ([]*Record, error) + func (c *Cache) Set(key int, record *Record) error + func (c *Cache) SetSchema(schema []string) + func (c *Cache) Size() int + func (c *Cache) Update(key int, updates map[string]interface{}) error + type Client struct + func New(adapter Adapter, config *Config) *Client + func (c *Client) Append(record *Record) error + func (c *Client) Close() error + func (c *Client) Delete(key int) error + func (c *Client) Get(key int) (*Record, error) + func (c *Client) Initialize(ctx context.Context) error + func (c *Client) Query(query Query) ([]*Record, error) + func (c *Client) Set(key int, record *Record) error + func (c *Client) Sync() error + func (c *Client) Update(key int, updates map[string]interface{}) error + type Condition struct + Column string + Operator string + Value interface{} + type Config struct + MaxRetries int + RetryInterval time.Duration + SyncInterval time.Duration + type Operation struct + Record *Record + Type OperationType + type OperationType int + const OpAdd + const OpDelete + const OpUpdate + type Query struct + Conditions []Condition + Limit int + Offset int + type Record struct + Key int + Values map[string]interface{} + func ApplyQuery(records []*Record, query Query) []*Record + func (r *Record) GetAsBool(col string, defaultValue bool) bool + func (r *Record) GetAsFloat64(col string, defaultValue float64) float64 + func (r *Record) GetAsInt64(col string, defaultValue int64) int64 + func (r *Record) GetAsString(col string, defaultValue string) string + func (r *Record) GetAsStrings(col string, defaultValue []string) []string + func (r *Record) GetAsTime(col string, defaultValue time.Time) time.Time + func (r *Record) MatchesQuery(query Query) bool + func (r *Record) SetBool(col string, value bool) + func (r *Record) SetFloat64(col string, value float64) + func (r *Record) SetInt64(col string, value int64) + func (r *Record) SetString(col string, value string) + func (r *Record) SetStrings(col string, value []string) + func (r *Record) SetTime(col string, value time.Time) + type SyncManager struct + func NewSyncManager(client *Client, interval time.Duration) *SyncManager + func (sm *SyncManager) Start() + func (sm *SyncManager) Stop() + type SyncStrategy int + const SyncStrategyCompacting + const SyncStrategyGapPreserving