lib

package
v0.0.0-...-d18f2d0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func CORSMiddleware

func CORSMiddleware(c *gin.Context)

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

func NewDB

func NewDB(env Env) Database

func (Database) Close

func (d Database) Close(ctx context.Context)

func (Database) Find

func (d Database) Find(ctx context.Context, res []models.Model, query bson.M, projection bson.M) error

func (Database) FindOne

func (d Database) FindOne(ctx context.Context, res models.Model, query bson.M, projection bson.M) error

func (Database) InsertOne

func (d Database) InsertOne(ctx context.Context, document models.Model) (*mongo.InsertOneResult, error)

func (Database) UpdateByID

func (d Database) UpdateByID(ctx context.Context, id primitive.ObjectID, updatedModel models.Model) error

type Env

type Env struct {
	AppUrl            string                          `mapstructure:"app_url"`
	ServerPort        string                          `mapstructure:"server_port"`
	DatabaseURI       string                          `mapstructure:"db_uri"`
	DatabaseName      string                          `mapstructure:"db_name"`
	RedisCredentials  *RedisCredentials               `mapstructure:"redis"`
	JWTSecret         string                          `mapstructure:"jwt_secret"`
	Environment       string                          `mapstructure:"environment"`
	Providers         map[string]*ProviderCredentials `mapstructure:"providers"`
	TwilioCredentials *TwilioCredentials              `mapstructure:"twilio"`
	SentryDsn         string                          `mapstructure:"sentry_dsn"`
}

func NewEnv

func NewEnv() Env

func (Env) IsProduction

func (e Env) IsProduction() bool

type ProviderCredentials

type ProviderCredentials struct {
	BaseUrl         string `mapstructure:"base_url"`
	BaseAuthUrl     string `mapstructure:"base_auth_url"`
	BaseApiUrl      string `mapstructure:"base_api_url"`
	ClientId        string `mapstructure:"client_id"`
	ClientSecret    string `mapstructure:"client_secret"`
	SubscriptionKey string `mapstructure:"subscription_key"`
	Scope           string `mapstructure:"scope"`
}

type Redis

type Redis struct {
	*redis.Client
}

func NewRedis

func NewRedis(env Env) Redis

type RedisCredentials

type RedisCredentials struct {
	Address  string `mapstructure:"address"`
	Password string `mapstructure:"password"`
	Database int    `mapstructure:"database"`
}

type RequestHandler

type RequestHandler struct {
	Gin *gin.Engine
}

func NewRequestHandler

func NewRequestHandler(env Env) RequestHandler

type TwilioCredentials

type TwilioCredentials struct {
	AccountSID string `mapstructure:"account_sid"`
	AuthToken  string `mapstructure:"auth_token"`
	VerifySID  string `mapstructure:"verify_sid"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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