storage

package
v0.0.0-...-4c68550 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package storage This memory storage is from: https://github.com/gofiber/fiber/blob/master/internal/memory/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Memory

type Memory struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewMemory

func NewMemory() *Memory

func (*Memory) Delete

func (s *Memory) Delete(key string)

Delete key by key

func (*Memory) Get

func (s *Memory) Get(key string) interface{}

Get value by key

func (*Memory) Reset

func (s *Memory) Reset()

Reset all keys

func (*Memory) Set

func (s *Memory) Set(key string, val interface{}, ttl time.Duration)

Set key with value

type Storage

type Storage interface {
	GetDatabase() *gorm.DB
	GetDatabaseWithContext(ctx context.Context) (*gorm.DB, context.CancelFunc)
}

type StorageConfig

type StorageConfig struct {
	Name       string `mapstructure:"name"`
	DataSource string `mapstructure:"dataSource"`
}

type Store

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

func NewStore

func NewStore(config *StorageConfig) (*Store, error)

func (*Store) GetDatabase

func (s *Store) GetDatabase() *gorm.DB

func (*Store) GetDatabaseWithContext

func (s *Store) GetDatabaseWithContext(ctx context.Context) (*gorm.DB, context.CancelFunc)

type TestStore

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

func NewTestStore

func NewTestStore() *TestStore

func (*TestStore) GetDatabase

func (s *TestStore) GetDatabase() *gorm.DB

func (*TestStore) GetDatabaseWithContext

func (s *TestStore) GetDatabaseWithContext(ctx context.Context) (*gorm.DB, context.CancelFunc)

Jump to

Keyboard shortcuts

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