common

package
v0.0.0-...-d86242d Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func AutoMigrate

func AutoMigrate(db *gorm.DB)

func Bind

func Bind(c *gin.Context, obj interface{}) error

func GenToken

func GenToken(id uuid.UUID) string

func GetClient

func GetClient() *ethclient.Client

func GetContractAddress

func GetContractAddress(currency string) common.Address

func GetDB

func GetDB() *gorm.DB

func GetEnv

func GetEnv(key string) string

func GetTokenABI

func GetTokenABI() string

func InitClient

func InitClient() *ethclient.Client

func InitDB

func InitDB() *gorm.DB

func LoadENV

func LoadENV()

func RunSeed

func RunSeed(db *gorm.DB, s SeedObject)

func RunSeeds

func RunSeeds(db *gorm.DB, seeds []SeedObject)

func StringTowei

func StringTowei(str string) *big.Int

func WeiToString

func WeiToString(wei *big.Int) string

Types

type CommonError

type CommonError struct {
	Errors map[string]interface{} `json:"errors"`
}

func NewError

func NewError(key string, err error) CommonError

func NewValidationError

func NewValidationError(err error) CommonError

type Database

type Database struct {
	*gorm.DB
}

type Seed

type Seed struct {
	ID        uuid.UUID `gorm:"type:uuid;default:gen_random_uuid();primaryKey"`
	Name      string    `gorm:"unique;not null"`
	CreatedAt time.Time `gorm:"autoCreateTime"`
	UpdatedAt time.Time `gorm:"autoUpdateTime"`
}

type SeedObject

type SeedObject struct {
	Name string
	Run  func(*gorm.DB) error
}

Jump to

Keyboard shortcuts

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