utils

package
v0.0.0-...-4d8054b Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DbCollectionConstant = DbCollectionConstants{
	DictionaryCollection:       "dictionaries",
	QuestionCollection:         "questions",
	OptionCollection:           "options",
	ArticleCollection:          "articles",
	CategoryCollection:         "categories",
	UserCollection:             "users",
	SavedCollection:            "saved",
	DIYCollection:              "diy",
	RewardCollection:           "rewards",
	BadgeCollection:            "badges",
	Badge_CollectionCollection: "badge_collections",
	QuestionResultCollection:   "question_results",
	QuizResultCollection:       "quiz_results",
	ExchangedCollection:        "exchanged",
	QRCollection:               "qrs",
}

Functions

func ContainsElement

func ContainsElement(arr []string, target string) bool

func GetCurrentTime

func GetCurrentTime() primitive.DateTime

func GetDatabaseCollection

func GetDatabaseCollection(name string, db *mongo.Client) *mongo.Collection

Types

type DbCollectionConstants

type DbCollectionConstants struct {
	DictionaryCollection       string
	QuestionCollection         string
	OptionCollection           string
	ArticleCollection          string
	CategoryCollection         string
	UserCollection             string
	SavedCollection            string
	DIYCollection              string
	RewardCollection           string
	BadgeCollection            string
	Badge_CollectionCollection string
	QuestionResultCollection   string
	QuizResultCollection       string
	ExchangedCollection        string
	QRCollection               string
}

type Response

type Response struct {
	Data    interface{} `json:"data" bson:"data"`
	Message string      `json:"message" bson:"message"`
}

func FailedResponse

func FailedResponse(message string) *Response

func SuccessfulResponse

func SuccessfulResponse(data interface{}, message string) *Response

type UserClaims

type UserClaims struct {
	ISS           string `json:"uuid"`
	AZP           string `json:"azp"`
	AUD           string `json:"aud"`
	SUB           string `json:"sub"`
	Email         string `json:"email"`
	EmailVerified bool   `json:"email_verified"`
	Name          string `json:"name"`
	Picture       string `json:"picture"`
	GivenName     string `json:"given_name"`
	FamilyName    string `json:"family_name"`
	Locale        string `json:"locale"`
	IAT           int64  `json:"iat"`
	EXP           int64  `json:"exp"`
}

func CheckJwtIsValidateAndGetJwtDecoded

func CheckJwtIsValidateAndGetJwtDecoded(jwt string) (UserClaims, bool)

Jump to

Keyboard shortcuts

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