sqlstore

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSQLStoreOption = SQLStoreOption{
	Ctx:       context.Background(),
	TableName: "echo_cache",
	DBName:    SQLite,
}

Functions

func New

func New(option SQLStoreOption) store.Store

Types

type DBName

type DBName int
const (
	SQLite DBName = iota
	PostgreSQL
	MySQL
)

func (DBName) String

func (n DBName) String() string

type SQLStore

type SQLStore struct {
	SQLStoreOption
	// contains filtered or unexported fields
}

func (*SQLStore) Get

func (sa *SQLStore) Get(key string) ([]byte, error)

func (*SQLStore) Set

func (sa *SQLStore) Set(key string, val []byte, ttl time.Duration) error

type SQLStoreOption

type SQLStoreOption struct {
	DB        *sql.DB
	Ctx       context.Context
	TableName string
	DBName    DBName
}

Jump to

Keyboard shortcuts

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