utils

package
v0.0.0-...-f91bbc8 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StripeClient client.API

Functions

func CheckModuleExists

func CheckModuleExists(module string) bool

CheckModuleExists : loop through list of modules to check if it included

func GetConfig

func GetConfig() models.Config

GetConfig returns config object

func GetDecodedJWT

func GetDecodedJWT(r *http.Request) jwt.MapClaims

GetDecodedJWT Returns decoded JWT object

func GetGoogleCloudClient

func GetGoogleCloudClient(ctx context.Context) (*storage.Client, error)

GetGoogleCloudClient : Return google cloud client

func GetLang

func GetLang(r *http.Request) string

GetLang returns user language

func GetStrings

func GetStrings(r *http.Request) map[string]string

GetStrings get strings

func GetSubdomain

func GetSubdomain(r *http.Request) string

GetSubdomain : return subdomain of request

func GetUserObjectID

func GetUserObjectID(r *http.Request) bson.ObjectId

GetUserObjectID : return id of jwt as type object id

func HasPremiumFeatures

func HasPremiumFeatures(site models.Site, size float64) bool

HasPremiumFeatures : i don't know

func InitGoogleCloud

func InitGoogleCloud()

func InitStripe

func InitStripe()

func IsAuthorized

func IsAuthorized(site models.Site, user models.User) bool

IsAuthorized : Check if a user is authorized to edit site

func NewJWT

func NewJWT(user models.User, expire int) (string, error)

NewJWT : generates new jwt

func RemoveGoogleCloudPhotos

func RemoveGoogleCloudPhotos(photos []models.Photo) error

RemoveGoogleCloudPhotos : remove photos from google cloud to save space

func RespondWithJSON

func RespondWithJSON(w http.ResponseWriter, code int, message string, payload interface{})

RespondWithJSON : Respond with JSON

func SendVerificationMail

func SendVerificationMail(email string, verification models.EmailVerification) error

SendVerificationMail : send verification email to user

func UpdateFilename

func UpdateFilename(fileID bson.ObjectId, filename string) error

UpdateFilename : update filename of a file

func UploadFile

func UploadFile(file multipart.File, fileName string) (bson.ObjectId, error)

UploadFile : upload file to google cloud

Types

type Response

type Response struct {
	Status  string      `json:"status"`
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Payload interface{} `json:"payload"`
}

Response Struct

Jump to

Keyboard shortcuts

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