shared

package
v0.0.0-...-822e787 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Database *gorm.DB
)

Functions

func AuthDataValidator

func AuthDataValidator(authType string, userSignupData UserSignupData) []map[string]string

func CheckIfStringInSlice

func CheckIfStringInSlice(s []string, str string) bool

func CreateUUID

func CreateUUID() string

func DbInitializers

func DbInitializers()

func GenerateJWT

func GenerateJWT(userData *domain.User) (string, error)

func GenerateRandomNumber

func GenerateRandomNumber(n int) int

func GetAuthToken

func GetAuthToken(r *http.Request, routeType string) string

func GetClientIP

func GetClientIP(r *http.Request) (string, error)

func GetUserIDsInChatMessage

func GetUserIDsInChatMessage(chat, prefix string) []string

func HashPassword

func HashPassword(password string) (string, error)

func LoadEnvVars

func LoadEnvVars()

func PasswordMatches

func PasswordMatches(hashedPassword, password string) bool

func RemoveUsersIDFromMessage

func RemoveUsersIDFromMessage(str string) string

func ServerChat

func ServerChat() string

Types

type AuthData

type AuthData struct {
}

type ErrorResponse

type ErrorResponse struct {
	StatusCode int         `json:"statusCode"`
	Message    string      `json:"message"`
	Errors     interface{} `json:"errors"`
}

type Message

type Message struct {
	MsgType     string            `json:"msgType"`
	ClientID    string            `json:"clientID"`
	ClientCount int               `json:"clientCount"`
	ClientsList map[string]string `json:"clientsList"`
	Action      string            `json:"action"`
	Message     string            `json:"message"`
	Sender      string            `json:"sender"`
	Private     bool              `json:"private"`
	To          []string          `json:"to"`
	Mentioned   bool              `json:"mentioned"`
	Date        time.Time         `json:"date"`
}

type Response

type Response struct {
	StatusCode int         `json:"statusCode"`
	Message    string      `json:"message"`
	Data       interface{} `json:"data"`
}

type UserSignupData

type UserSignupData struct {
	Email           string `json:"email"`
	Password        string `json:"password"`
	ConfirmPassword string `json:"confirmPassword"`
}

Jump to

Keyboard shortcuts

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