tool

package
v0.0.0-...-aef14cd Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Unlicense Imports: 22 Imported by: 0

Documentation

Overview

Package tool TODO.

Package tool TODO.

Package tool TODO.

Package tool TODO.

Package tool TODO.

Package tool TODO.

Package tool TODO.

Package tool TODO.

Package tool TODO.

Package tool TODO.

Package tool TODO.

Package tool TODO.

Index

Constants

View Source
const MSG = "go-favorites.tool "

Variables

View Source
var (
	ErrEncryptAES = fmt.Errorf("encrypt with AES")
	ErrEncryptRSA = fmt.Errorf("encrypt with RSA")
	ErrDecryptRSA = fmt.Errorf("decrypt with RSA")
)

Functions

func ConvertBoolPointerToNullBool

func ConvertBoolPointerToNullBool(b *bool) sql.NullBool

func ConvertNullBoolToBoolPointer

func ConvertNullBoolToBoolPointer(b sql.NullBool) *bool

func ConvertNullTimeToTimePointer

func ConvertNullTimeToTimePointer(t sql.NullTime) *time.Time

func ConvertTimePointerToNullTime

func ConvertTimePointerToNullTime(t *time.Time) sql.NullTime

func DBConnect

func DBConnect(dsn string) *pgxpool.Pool

func DecryptAES

func DecryptAES(secretKey, bytes []byte) ([]byte, error)

func DecryptRSA

func DecryptRSA(rsaPrivateKey *rsa.PrivateKey, bytes []byte) ([]byte, error)

func EncryptAES

func EncryptAES(secretKey, plain []byte) ([]byte, error)

func EncryptRSA

func EncryptRSA(rsaPublicKey *rsa.PublicKey, plain []byte) ([]byte, error)

func FileClose

func FileClose(file *os.File)

func FileCloseAndLog

func FileCloseAndLog(file *os.File)

func GetCollection

func GetCollection(conn *mongo.Client, dbname, collection string) *mongo.Collection

func IfErrorThenPanic

func IfErrorThenPanic(e error)

func IsUpperBound

func IsUpperBound(index int, duration time.Duration) bool

func IsUpperBoundWithSleep

func IsUpperBoundWithSleep(index, sleep int, duration time.Duration) bool

func LoadClientTLSCredentials

func LoadClientTLSCredentials(caCertFile string) (credentials.TransportCredentials, error)

func LoadPrivateKey

func LoadPrivateKey(fileName string) *rsa.PrivateKey

func LoadPublicKey

func LoadPublicKey(fileName string) *rsa.PublicKey

func LoadServerTLSCredentials

func LoadServerTLSCredentials(certFile, keyFile string) (credentials.TransportCredentials, error)

func NoRowsInResultSet

func NoRowsInResultSet(err error) bool

func RandStringBytes

func RandStringBytes(n int) string

func TraceInOut

func TraceInOut(ctx context.Context, name, format string, values ...any) func()

Types

type MongoPool

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

func MongodbConnect

func MongodbConnect(dsn string) *MongoPool

func (*MongoPool) CloseConnection

func (mp *MongoPool) CloseConnection(conn *mongo.Client) error

func (*MongoPool) GetConnection

func (mp *MongoPool) GetConnection() (*mongo.Client, error)

Jump to

Keyboard shortcuts

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