data

package
v0.0.0-...-3a79dc6 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UsersMapMock = map[string]int{
		"advisor":     1,
		"agent":       5,
		"initiator":   7,
		"contributor": 0,
		"investor":    10,
		"mentor":      5,
		"contractor":  31,
	}
	UsersCountMock = 0
)

MOCK

View Source
var (
	ErrDynamoDBNoEncryptionKey = errors.New("cannot create DynamoDB: poln's encryption key is missing")
	ErrDynamoDBNoTableName     = errors.New("cannot create DynamoDB: no table name")
	ErrBadMax                  = errors.New("incorrect max")
	ErrInvalidUser             = errors.New("nil user or missing required field")
)
View Source
var MockDB = mockDB{}

Functions

func NewDynamoDB

func NewDynamoDB(tn, ek string) (db *dynamoDB, err error)

func NewMockDBContent

func NewMockDBContent(l []string) *mockDBContent

func NewMockErrDB

func NewMockErrDB(l []string) *mockErrDB

func NewMockErrFindingAddress

func NewMockErrFindingAddress(l []string, a string) *mockErrFindingAddress

Types

type DB

type DB interface {
	Save(u *User) error
	Count() (map[string]int, error)
	List(options ...int) ([]*User, error)
	IsPresent(a string) (bool, error)
}

type User

type User struct {
	Address   string `json:"address" binding:"required,eth_addr" validate:"required,eth_addr"`
	Email     string `json:"email" binding:"required,email" validate:"required,email"`
	UUID      string `json:"uuid,omitempty" validate:"required,uuid"`
	Timestamp int64  `json:"timestamp,omitempty" validate:"gt=0"`
	Type      string `` /* 188-byte string literal not displayed */
	Sponsor   string `json:"sponsor" binding:"required,eth_addr" validate:"required,eth_addr"`
}

func NewUser

func NewUser(a, e, t, s string) *User

func (*User) IsSet

func (u *User) IsSet() bool

IsSet tests if only required fields are valid

func (*User) IsValid

func (u *User) IsValid() bool

IsValid tests if all fields are valid

func (*User) Setup

func (u *User) Setup()

func (User) String

func (u User) String() string

Jump to

Keyboard shortcuts

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