Documentation ¶
Index ¶
- Variables
- type Config
- type Storage
- func (s *Storage) Close() error
- func (s *Storage) Conn() (*nats.Conn, jetstream.KeyValue)
- func (s *Storage) Delete(key string) error
- func (s *Storage) Get(key string) ([]byte, error)
- func (s *Storage) Keys() ([]string, error)
- func (s *Storage) Reset() error
- func (s *Storage) Set(key string, val []byte, exp time.Duration) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ConfigDefault = Config{ URLs: nats.DefaultURL, Context: context.Background(), ClientName: "fiber_storage", KeyValueConfig: jetstream.KeyValueConfig{ Bucket: "fiber_storage", }, WaitForConnection: 100 * time.Millisecond, }
ConfigDefault is the default config
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Nats URLs, default "nats://127.0.0.1:4222". Can be comma separated list for multiple servers URLs string // Nats connection options. See nats_test.go for an example of how to use this. NatsOptions []nats.Option // Nats connection name ClientName string // Nats context Context context.Context // Nats key value config KeyValueConfig jetstream.KeyValueConfig // Logger. Using Fiber AllLogger interface for adapting the various log libraries. Logger log.AllLogger // Use the Logger for nats events, default: false Verbose bool // Wait for connection to be established, default: 100ms WaitForConnection time.Duration }
Config defines the config for storage.
Click to show internal directories.
Click to hide internal directories.