utils

package
v0.0.0-...-b69bc49 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeMD5

func EncodeMD5(value string) string

EncodeMD5 implements md5 encryption

func EncryptString

func EncryptString(toEncrypt string) string

EncryptString encrypts strings such as password

func GenerateToken

func GenerateToken(username, password string, uid int) (string, error)

GenerateToken generate tokens used for auth

func GetConfig

func GetConfig() *viper.Viper

GetConfig returns the global config

func GetDataURL

func GetDataURL() string

GetDataURL returns the database url for gorm connection

Types

type Claims

type Claims struct {
	Username string `json:"username"`
	Password string `json:"password"`
	UserID   int    `json:"uid"`
	jwt.StandardClaims
}

Claims stores basic encrypted user information

func ParseToken

func ParseToken(token string) (*Claims, error)

ParseToken parsing token

type SingletonMySQL

type SingletonMySQL struct {
	Database *gorm.DB
}

SingletonMySQL constructs the Database Connector

func GetMySQLInstance

func GetMySQLInstance() *SingletonMySQL

GetMySQLInstance returns a MySQL Instance Written By Indexyz @ Cloudhammer/Seeds

Jump to

Keyboard shortcuts

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