util

package
v0.0.0-...-a90a58e Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(cipherText, key string) (string, error)

decrypt decrypts cipherText using AES decryption with the given key

func Encrypt

func Encrypt(plainText, key string) (string, error)

encrypt encrypts plainText using AES encryption with the given key

func ParseIntToString

func ParseIntToString(i int) string

parse int to string

func ParseStringToInt32

func ParseStringToInt32(s string) (int32, error)

parse number in string to int32

func ParseStringToInt64

func ParseStringToInt64(s string) (int64, error)

parse number in string to int64

func RandomInt

func RandomInt(min, max int64) int64

RandomInt generates a random integer between min and max

func RandomString

func RandomString(n int) string

RandomString generates a random string of length n

func RandomUserID

func RandomUserID() string

RandomUserID generates a random user_id

func StringToText

func StringToText(s string) pgtype.Text

convert string to pgtype.Text

func StringToTimestamp

func StringToTimestamp(s string) pgtype.Timestamptz

convert string timestamp to pgtype.Timestamp

func UUIDToUUID

func UUIDToUUID(s uuid.UUID) pgtype.UUID

convert uuid.UUID to pgtype.UUID

Types

type Config

type Config struct {
	DBSource             string        `mapstructure:"DB_SOURCE"`
	ServerAddress        string        `mapstructure:"SERVER_ADDRESS"`
	TokenSymmetricKey    string        `mapstructure:"TOKEN_SYMMETRIC_KEY"`
	AccessTokenDuration  time.Duration `mapstructure:"ACCESS_TOKEN_DURATION"`
	RefreshTokenDuration time.Duration `mapstructure:"REFRESH_TOKEN_DURATION"`
	TwitchClientID       string        `mapstructure:"TWITCH_CLIENT_ID"`
	TwitchClientSecret   string        `mapstructure:"TWITCH_SECRET_ID"`
	FeAddress            string        `mapstructure:"FE_ADDRESS"`
	BeAddress            string        `mapstructure:"BE_ADDRESS"`
	TwitchEventsubSecret string        `mapstructure:"TWITCH_EVENTSUB_SECRET"`
}

Config is a struct for holding configuration values The values are read by Viper from the environment variables

func LoadConfig

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

LoadConfig loads the configuration from file or environment variables

Jump to

Keyboard shortcuts

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