sqlstore

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DocIndexConfigRow

type DocIndexConfigRow struct {
	DB         int       `gorm:"column:db;primaryKey;autoIncrement:false"`
	Collection string    `gorm:"column:collection;primaryKey;size:191"`
	Kind       string    `gorm:"column:kind;primaryKey;size:32"`
	Field      string    `gorm:"column:field;primaryKey;size:191"`
	CreatedAt  time.Time `gorm:"column:created_at;autoCreateTime"`
}

func (DocIndexConfigRow) TableName

func (DocIndexConfigRow) TableName() string

type DocIndexRow

type DocIndexRow struct {
	DB          int       `gorm:"column:db;primaryKey;autoIncrement:false"`
	Collection  string    `gorm:"column:collection;primaryKey;size:191;index:idx_redge_doc_indexes_lookup,priority:1"`
	Field       string    `gorm:"column:field;primaryKey;size:191;index:idx_redge_doc_indexes_lookup,priority:2"`
	ValueHash   string    `gorm:"column:value_hash;primaryKey;size:64;index:idx_redge_doc_indexes_lookup,priority:3"`
	ID          string    `gorm:"column:id;primaryKey;size:191;index:idx_redge_doc_indexes_lookup,priority:4"`
	DisplayText string    `gorm:"column:display_text;type:text"`
	CreatedAt   time.Time `gorm:"column:created_at;autoCreateTime"`
}

func (DocIndexRow) TableName

func (DocIndexRow) TableName() string

type DocRow

type DocRow struct {
	DB         int        `gorm:"column:db;primaryKey;autoIncrement:false"`
	Collection string     `gorm:"column:collection;primaryKey;size:191;index:idx_redge_docs_collection_id,priority:1"`
	ID         string     `gorm:"column:id;primaryKey;size:191;index:idx_redge_docs_collection_id,priority:2"`
	Value      []byte     `gorm:"column:value;not null"`
	SearchText string     `gorm:"column:search_text;type:text"`
	ExpiresAt  *time.Time `gorm:"column:expires_at;index"`
	Version    int64      `gorm:"column:version;not null;default:1"`
	CreatedAt  time.Time  `gorm:"column:created_at;autoCreateTime"`
	UpdatedAt  time.Time  `gorm:"column:updated_at;autoUpdateTime"`
}

func (DocRow) TableName

func (DocRow) TableName() string

type KeyRow

type KeyRow struct {
	DB          int        `gorm:"column:db;primaryKey;autoIncrement:false"`
	Key         string     `gorm:"column:key;primaryKey;size:512"`
	Type        string     `gorm:"column:type;not null;size:32;index"`
	StringValue []byte     `gorm:"column:string_value"`
	ExpiresAt   *time.Time `gorm:"column:expires_at;index"`
	Version     int64      `gorm:"column:version;not null;default:1"`
	CreatedAt   time.Time  `gorm:"column:created_at;autoCreateTime"`
	UpdatedAt   time.Time  `gorm:"column:updated_at;autoUpdateTime"`
}

func (KeyRow) TableName

func (KeyRow) TableName() string

type Store

type Store struct {
	// contains filtered or unexported fields
}

func New

func New(conn *database.Connection, log *zap.Logger) (*Store, error)

func (*Store) CleanupExpired

func (s *Store) CleanupExpired(ctx context.Context, limit int) (int64, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) ConfigureIndexes

func (s *Store) ConfigureIndexes(ctx context.Context, db int, collection string, cfg docstore.IndexConfig) (docstore.IndexConfig, error)

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, db int, keys ...string) (int64, error)

func (*Store) DeleteDoc

func (s *Store) DeleteDoc(ctx context.Context, db int, collection, id string) (bool, error)

func (*Store) Exists

func (s *Store) Exists(ctx context.Context, db int, keys ...string) (int64, error)

func (*Store) Expire

func (s *Store) Expire(ctx context.Context, db int, key string, ttl time.Duration) (bool, error)

func (*Store) Get

func (s *Store) Get(ctx context.Context, db int, key string) (*store.Value, error)

func (*Store) GetDel

func (s *Store) GetDel(ctx context.Context, db int, key string) (*store.Value, bool, error)

func (*Store) GetDoc

func (s *Store) GetDoc(ctx context.Context, db int, collection, id string) (docstore.Document, error)

func (*Store) GetIndexConfig

func (s *Store) GetIndexConfig(ctx context.Context, db int, collection string) (docstore.IndexConfig, error)

func (*Store) IncrBy

func (s *Store) IncrBy(ctx context.Context, db int, key string, delta int64) (int64, error)

func (*Store) MGet

func (s *Store) MGet(ctx context.Context, db int, keys ...string) ([]*store.Value, error)

func (*Store) MSet

func (s *Store) MSet(ctx context.Context, db int, pairs []store.KeyValue, opts store.SetOptions) error

func (*Store) Migrate

func (s *Store) Migrate(ctx context.Context) error

func (*Store) MigrateDocs

func (s *Store) MigrateDocs(ctx context.Context) error

func (*Store) Persist

func (s *Store) Persist(ctx context.Context, db int, key string) (bool, error)

func (*Store) Ping

func (s *Store) Ping(ctx context.Context) error

func (*Store) PutDoc

func (s *Store) PutDoc(ctx context.Context, db int, collection, id string, value []byte, opts docstore.WriteOptions, createOnly bool) (docstore.Document, bool, error)

func (*Store) QueryDocs

func (s *Store) QueryDocs(ctx context.Context, db int, collection string, opts docstore.QueryOptions) (docstore.QueryResult, error)

func (*Store) Scan

func (s *Store) Scan(ctx context.Context, db int, cursor string, pattern string, count int) (store.ScanResult, error)

func (*Store) Set

func (s *Store) Set(ctx context.Context, db int, key string, value []byte, opts store.SetOptions) (*store.Value, bool, error)

func (*Store) Stats

func (s *Store) Stats(ctx context.Context, db int) (store.Stats, error)

func (*Store) TTL

func (s *Store) TTL(ctx context.Context, db int, key string) (time.Duration, bool, bool, error)

func (*Store) Type

func (s *Store) Type(ctx context.Context, db int, key string) (string, error)

func (*Store) ZAdd

func (s *Store) ZAdd(ctx context.Context, db int, key string, score float64, member []byte) (int64, error)

func (*Store) ZCard

func (s *Store) ZCard(ctx context.Context, db int, key string) (int64, error)

func (*Store) ZCount

func (s *Store) ZCount(ctx context.Context, db int, key string, min, max store.ScoreBound) (int64, error)

func (*Store) ZRange

func (s *Store) ZRange(ctx context.Context, db int, key string, start, stop int64) ([]store.ZMember, error)

func (*Store) ZRangeByScore

func (s *Store) ZRangeByScore(ctx context.Context, db int, key string, min, max store.ScoreBound, offset, limit int64, rev bool) ([]store.ZMember, error)

func (*Store) ZRem

func (s *Store) ZRem(ctx context.Context, db int, key string, members ...[]byte) (int64, error)

func (*Store) ZRemRangeByScore

func (s *Store) ZRemRangeByScore(ctx context.Context, db int, key string, min, max store.ScoreBound) (int64, error)

func (*Store) ZScore

func (s *Store) ZScore(ctx context.Context, db int, key string, member []byte) (float64, bool, error)

type ZSetMemberRow

type ZSetMemberRow struct {
	DB         int       `gorm:"column:db;primaryKey;autoIncrement:false"`
	Key        string    `gorm:"column:key;primaryKey;size:512;index:idx_redge_zset_score,priority:1"`
	MemberHash string    `gorm:"column:member_hash;primaryKey;size:64"`
	Member     []byte    `gorm:"column:member;not null"`
	Score      float64   `gorm:"column:score;not null;index:idx_redge_zset_score,priority:2"`
	CreatedAt  time.Time `gorm:"column:created_at;autoCreateTime"`
	UpdatedAt  time.Time `gorm:"column:updated_at;autoUpdateTime"`
}

func (ZSetMemberRow) TableName

func (ZSetMemberRow) TableName() string

Jump to

Keyboard shortcuts

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