Documentation ¶
Overview ¶
Package storage contains all about storage.
Index ¶
Constants ¶
View Source
const ( PGxDriverName = "pgx" // SqliteDriverName sqlite driver. SqliteDriverName = "sqlite" )
Driver name variants.
Variables ¶
View Source
var ErrDupOriginalURL = errors.New("duplicated original url")
ErrDupOriginalURL error when original url is duplicated.
Functions ¶
Types ¶
type DuplicateError ¶
DuplicateError custom error for situation when original url is duplicated.
type Storage ¶
type Storage interface { TruncateRecords() error PutSecretKey(secretKey []byte) error GetSecretKey() (secretKey []byte, err error) PutRecord(r *btypes.Record) error PutRecords(r []*btypes.Record) error GetRecord(key string) (r *btypes.Record, err error) GetAllUserRecords(user btypes.User) (userKey2Record map[string]*btypes.Record, err error) DeleteUserRecords(user btypes.User, recordKeys []string) error Ping() error }
Storage is main interface for storage.
func NewDBStorage ¶
NewDBStorage create new db storage.
func NewInFileDBStorage ¶
NewInFileDBStorage create new in file db storage.
func NewInMemoryDBStorage ¶
NewInMemoryDBStorage create new in memory db storage.
Click to show internal directories.
Click to hide internal directories.