util

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(password string, hashedPassword string) error

ハッシュ化されたパスワードと生のパスワードが等しいものかをチェックする。

func HashPassword

func HashPassword(password string) (string, error)

bcryptを使ってハッシュ化されたパスワードを取得する。

func RandomAge

func RandomAge() int32

ランダムな年齢を取得する。 2桁のランダムな数値を返す。

func RandomAmount

func RandomAmount() int64

ランダムな食品の個数を取得する。 1-3までのランダムな浮動小数点を返す。

func RandomBalance

func RandomBalance() int64

ランダムな残高を取得する。 1億までのランダムな数値を返す。

func RandomCalories

func RandomCalories() float32

ランダムなカロリーを取得する。 0.0-700.0までのランダムな浮動小数点を返す。

func RandomEmail

func RandomEmail() string

ランダムなメールアドレスを取得する。 メールアドレスの形式に則った文字列を返す。

func RandomExpense

func RandomExpense() int64

ランダムな支出額を取得する。 100-30000までのランダムな整数値を返す。

func RandomFoodName

func RandomFoodName() string

ランダムな食品名を取得する。 6文字からなるランダムな文字列を返す。

func RandomID

func RandomID() int64

func RandomIPAddress

func RandomIPAddress() string

ランダムなIPアドレスを取得する。 xxx.xxx.xxx.xxx の形式の値を返す。

func RandomInt

func RandomInt(min, max int64) int64

min 以上 max 以下のランダムな整数値を取得する。 min が max より大きい時 panic を起こす。

func RandomNutrient

func RandomNutrient() float32

ランダムな各栄養素の値(g)を取得する。 0.0-70.0までのランダムな浮動小数点を返す。

func RandomPassword

func RandomPassword() string

ランダムなパスワードを取得する。 12文字からなるランダムな文字列を返す。

func RandomStoreName

func RandomStoreName() string

ランダムな店名を取得する。 9文字からなるランダムな文字列を返す。

func RandomString

func RandomString(n int) string

n 文字のランダムな文字列を取得する。 文字列は全てアルファベットのみで構成される。

func RandomUserName

func RandomUserName() string

ランダムなユーザー名を取得する。 7文字からなるランダムな文字列を返す。

Types

type Config

type Config struct {
	DBDriver        string        `mapstructure:"DB_DRIVER"`
	DBSource        string        `mapstructure:"DB_SOURCE"`
	ServerAddress   string        `mapstructure:"SERVER_ADDRESS"`
	SessionDuration time.Duration `mapstructure:"SESSION_DURATION"`
}

func LoadConfig

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

Jump to

Keyboard shortcuts

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