Documentation
¶
Overview ¶
Package sql provides a SQL-based storage backend for gopotency. It supports any database compatible with database/sql, such as PostgreSQL, MySQL, or SQLite.
Index ¶
- type Storage
- func (s *Storage) Close() error
- func (s *Storage) Delete(ctx context.Context, key string) error
- func (s *Storage) Exists(ctx context.Context, key string) (bool, error)
- func (s *Storage) Get(ctx context.Context, key string) (*idempotency.Record, error)
- func (s *Storage) Set(ctx context.Context, record *idempotency.Record, ttl time.Duration) error
- func (s *Storage) TryLock(ctx context.Context, key string, ttl time.Duration) (bool, error)
- func (s *Storage) Unlock(ctx context.Context, key string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is a SQL implementation of idempotency.Storage
func NewSQLStorage ¶
NewSQLStorage creates a new SQL storage instance. This implementation is optimized for PostgreSQL and SQLite as it uses positional placeholders ($1, $2) and "ON CONFLICT" syntax.
Click to show internal directories.
Click to hide internal directories.