storage

package
v0.0.0-...-8591075 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commitment

type Commitment struct {
	Id              []byte `gorm:"primary_key"`
	Contract        []byte `gorm:"not null"`
	Wallet          string `gorm:"not null"`
	NominatorWallet string
	Email           string
	Signature       []byte `gorm:"not null"`
	SelectedStake   int
	MaxStake        int `gorm:"default:137068"`
	CreatedAt       time.Time
}

type DatabaseImpl

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

DatabaseImpl struct implements the Database Interface with an underlying DB

func (*DatabaseImpl) GetCommitment

func (db *DatabaseImpl) GetCommitment(id string) (*Commitment, error)

func (*DatabaseImpl) GetMember

func (db *DatabaseImpl) GetMember(id string) (*Member, error)

func (*DatabaseImpl) InsertCommitment

func (db *DatabaseImpl) InsertCommitment(commitment Commitment) error

func (*DatabaseImpl) InsertMembers

func (db *DatabaseImpl) InsertMembers(members []Member) error

type MapImpl

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

MapImpl struct implements the database interface with an underlying Map

func (*MapImpl) GetCommitment

func (db *MapImpl) GetCommitment(id string) (*Commitment, error)

func (*MapImpl) GetMember

func (db *MapImpl) GetMember(id string) (*Member, error)

func (*MapImpl) InsertCommitment

func (db *MapImpl) InsertCommitment(commitment Commitment) error

func (*MapImpl) InsertMembers

func (db *MapImpl) InsertMembers(members []Member) error

type Member

type Member struct {
	Id   []byte `gorm:"primary_key"`
	Cert []byte `gorm:"NOT NULL"`
}

type Params

type Params struct {
	Username string
	Password string
	DBName   string
	Address  string
	Port     string
}

type Storage

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

Storage struct is the API for the storage package

func NewStorage

func NewStorage(params Params) (*Storage, error)

NewStorage creates a new Storage object wrapping a database interface Returns a Storage object, and error

func (*Storage) GetMapImpl

func (s *Storage) GetMapImpl(t *testing.T) *MapImpl

Jump to

Keyboard shortcuts

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