util

package
v0.0.0-...-707bc42 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(regex string, limit int) (string, error)

func IsLower

func IsLower(s string) bool

func IsUpper

func IsUpper(s string) bool

func RandomCountry

func RandomCountry() string

RandomCurrency generates a random currency code

func RandomEmail

func RandomEmail() string

RandomEmail generates a random email

func RandomInt

func RandomInt(min, max int64) int64

RandomInt generates a random integer between min and max

func RandomNumber

func RandomNumber() int64

RandomMoney generates a random amount of money

func RandomOwner

func RandomOwner() string

RandomOwner generates a random owner name

func RandomString

func RandomString(n int) string

RandomString generates a random string of length n

func RandomWalletAddress

func RandomWalletAddress() string

RandomWalletAddress

Types

type Config

type Config struct {
	DBDriver                 string        `mapstructure:"DB_DRIVER"`
	DBSource                 string        `mapstructure:"DB_SOURCE"`
	MigrationURL             string        `mapstructure:"MIGRATION_URL"`
	HTTPServerAddress        string        `mapstructure:"HTTP_SERVER_ADDRESS"`
	GRPCServerAddress        string        `mapstructure:"GRPC_SERVER_ADDRESS"`
	AccessTokenSymmetricKey  string        `mapstructure:"ACCESS_TOKEN_SYMMETRIC_KEY"`
	RefreshTokenSymmetricKey string        `mapstructure:"REFRESH_TOKEN_SYMMETRIC_KEY"`
	AccessTokenDuration      time.Duration `mapstructure:"ACCESS_TOKEN_DURATION"`
	RefreshTokenDuration     time.Duration `mapstructure:"REFRESH_TOKEN_DURATION"`
	EnableProfiler           bool          `mapstructure:"ENABLE_PROFILER"`
	AlchemyApiUrl            string        `mapstructure:"ALCHEMY_API_URL"`
	AlchemyNftApiUrl         string        `mapstructure:"ALCHEMY_NFT_API_URL"`
	IFFNftContractAddress    string        `mapstructure:"IFFNFT_CONTRACT_ADDRESS"`
	MoralisApiUrl            string        `mapstructure:"MORALIS_API_URL"`
	MoralisApiKey            string        `mapstructure:"MORALIS_API_KEY"`
	MoralisEthNetwork        string        `mapstructure:"MORALIS_ETH_NETWORK"`
	BlackholeAddress         string        `mapstructure:"BLACKHOLE_ADDRESS"`
}

Config stores all configuration of the application. The values are read by viper from a config file or environment variable.

func LoadConfig

func LoadConfig(path string) (config Config, err error)

LoadConfig reads configuration from file or environment variables.

type Generator

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

func NewGenerator

func NewGenerator(regex string) (*Generator, error)

create a new generator

func (*Generator) Generate

func (g *Generator) Generate(limit int) string

limit is the maximum number of times star, range or plus should repeat i.e. [0-9]+ will generate at most 10 characters if this is set to 10

func (*Generator) SetSeed

func (gen *Generator) SetSeed(seed int64)

type Logger

type Logger struct {
	*log.Logger
}

func NewLogger

func NewLogger() *Logger

func (*Logger) Debugf

func (l *Logger) Debugf(s string, i ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(s string, i ...interface{})

func (*Logger) Infof

func (l *Logger) Infof(s string, i ...interface{})

Jump to

Keyboard shortcuts

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