helpers

package module
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: MIT Imports: 12 Imported by: 1

README

Go Functions Helper

Installation

go get github.com/Girein/helpers-go

Functions

// ToDateTimeString converts DateTime into string with Y-m-d H:i:s format
func ToDateTimeString(dateTime time.Time) string {}

// GormOpen returns database connection
func GormOpen(driver string) *gorm.DB {}

// LogIfError logs the error with message
func LogIfError(err error, message string) {}

// RandomString generates random string with custom length
func RandomString(length int) string {}

// RandomInteger returns random integer between parameters
func RandomInteger(min int, max int) int {}

// JSONEncode converts data into JSON string
func JSONEncode(data interface{}) string {}

// InArray checks if a value exists in an array
func InArray(needle string, haystack []interface{}) bool {}

// AESEncrypt encrypts text using cipher AES/ECB/PKCS5PADDING
func AESEncrypt(text string, key []byte) string {}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AESEncrypt added in v1.0.7

func AESEncrypt(text string, key []byte) string

AESEncrypt encrypts text using cipher AES/ECB/PKCS5PADDING

func GormOpen added in v1.0.1

func GormOpen(driver string) *gorm.DB

GormOpen returns database connection

func InArray added in v1.0.6

func InArray(needle string, haystack []interface{}) bool

InArray checks if a value exists in an array

func JSONEncode added in v1.0.5

func JSONEncode(data interface{}) string

JSONEncode converts data into JSON string

func LogIfError added in v1.0.4

func LogIfError(err error, message string)

LogIfError logs the error with message

func NewECBEncrypter added in v1.0.7

func NewECBEncrypter(b cipher.Block) cipher.BlockMode

NewECBEncrypter returns a BlockMode which encrypts in ecb mode, using the given Block

func PKCS5Padding added in v1.0.7

func PKCS5Padding(ciphertext []byte, blockSize int) []byte

PKCS5Padding adds PKCS5 padding

func RandomInteger added in v1.0.4

func RandomInteger(min int, max int) int

RandomInteger returns random integer between parameters

func RandomString added in v1.0.4

func RandomString(length int) string

RandomString generates random string with custom length

func ToDateTimeString

func ToDateTimeString(dateTime time.Time) string

ToDateTimeString converts DateTime into string with Y-m-d H:i:s format

Types

This section is empty.

Jump to

Keyboard shortcuts

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