core

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RedisDBCache          = 0
	RedisDBMQ             = 1
	RedisDBRateLimiter    = 2
	RedisDBAuthSession    = 3
	RedisDBAuthOAuthState = 4
)

Functions

func ErrorPage

func ErrorPage(title string, code string, message string, homeLink string) string

func StreamErrorPage

func StreamErrorPage(qw422016 *qt422016.Writer, title string, code string, message string, homeLink string)

func WriteErrorPage

func WriteErrorPage(qq422016 qtio422016.Writer, title string, code string, message string, homeLink string)

Types

type AppConfigs

type AppConfigs struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Env     string `json:"env"`
}

type Container

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

func NewContainer

func NewContainer(config contracts.Config, logger contracts.Logger, appConfig *GoeConfig) *Container

func UseGoeContainer

func UseGoeContainer() *Container

func (*Container) Close

func (c *Container) Close() error

Close closes the container and its dependencies. DON'T NEED TO CALL THIS METHOD MANUALLY, IT WILL BE CALLED AUTOMATICALLY WHEN THE APP SHUTS DOWN.

func (*Container) GetCache

func (c *Container) GetCache() contracts.Cache

func (*Container) GetConfig

func (c *Container) GetConfig() contracts.Config

func (*Container) GetCron

func (c *Container) GetCron() contracts.CronJob

func (*Container) GetFiber

func (c *Container) GetFiber() contracts.GoeFiber

func (*Container) GetLogger

func (c *Container) GetLogger() contracts.Logger

func (*Container) GetMailer

func (c *Container) GetMailer() contracts.Mailer

func (*Container) GetMeilisearch

func (c *Container) GetMeilisearch() contracts.Meilisearch

func (*Container) GetMongo

func (c *Container) GetMongo() contracts.MongoDB

func (*Container) GetQueue

func (c *Container) GetQueue() contracts.Queue

func (*Container) InitCache

func (c *Container) InitCache()

func (*Container) InitCron

func (c *Container) InitCron()

func (*Container) InitFiber

func (c *Container) InitFiber()

func (*Container) InitMailer

func (c *Container) InitMailer()

func (*Container) InitMeilisearch

func (c *Container) InitMeilisearch()

func (*Container) InitMongo

func (c *Container) InitMongo()

func (*Container) InitQueue

func (c *Container) InitQueue()

type GoeConfig

type GoeConfig struct {
	App         *AppConfigs
	Features    *GoeConfigFeatures
	MongoDB     *GoeConfigMongodb
	Redis       *GoeConfigRedis
	Meilisearch *GoeConfigMeilisearch
	Mailer      *GoeConfigMailer
	Queue       *GoeConfigQueue
	Http        *GoeConfigHttp
	Session     *GoeConfigSession
	S3          *GoeConfigS3
	OIDC        *GoeOIDCConfig
}

func UseGoeConfig

func UseGoeConfig() *GoeConfig

type GoeConfigFeatures

type GoeConfigFeatures struct {
	MongoDBEnabled      bool `json:"mongodb_enabled"`
	MeilisearchEnabled  bool `json:"meilisearch_enabled"`
	SearchDBSyncEnabled bool `json:"search_db_sync_enabled"`
	SMTPMailerEnabled   bool `json:"smtp_mailer_enabled"`
}

type GoeConfigHttp

type GoeConfigHttp struct {
	Port            string   `json:"port"`
	ServerHeader    string   `json:"server_header"`
	BodyLimit       int      `json:"body_limit"`
	Concurrency     int      `json:"concurrency"`
	ProxyHeader     string   `json:"proxy_header"`
	TrustProxyCheck bool     `json:"trust_proxy_check"`
	TrustProxies    []string `json:"trust_proxies"`
	ReduceMemory    bool     `json:"reduce_memory"`
	IPValidation    bool     `json:"ip_validation"`
}

type GoeConfigMailer

type GoeConfigMailer struct {
	Host      string `json:"host"`
	Port      int    `json:"port"`
	Username  string `json:"username"`
	Password  string `json:"password"`
	Tls       bool   `json:"tls"`
	LocalName string `json:"local_name"`
	FromEmail string `json:"from_email"`
	FromName  string `json:"from_name"`
}

type GoeConfigMeilisearch

type GoeConfigMeilisearch struct {
	Endpoint string `json:"endpoint"`
	ApiKey   string `json:"api_key"`
}

type GoeConfigMongodb

type GoeConfigMongodb struct {
	URI string `json:"uri"`
	DB  string `json:"db"`
}

type GoeConfigQueue

type GoeConfigQueue struct {
	ConcurrentWorkers  int `json:"concurrent_workers"`
	FetchInterval      int `json:"fetch_interval"`
	FetchLimit         int `json:"fetch_limit"`
	MaxConsumeDuration int `json:"max_consume_duration"`
	DefaultRetries     int `json:"default_retries"`
}

type GoeConfigRedis

type GoeConfigRedis struct {
	Host     string `json:"host"`
	Port     int    `json:"port"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type GoeConfigS3

type GoeConfigS3 struct {
	Endpoint     string `json:"endpoint"`
	AccessKey    string `json:"access_key"`
	SecretKey    string `json:"secret_key"`
	Bucket       string `json:"bucket"`
	Region       string `json:"region"`
	BucketLookup string `json:"bucket_lookup"`
	UseSSL       bool   `json:"use_ssl"`
	Token        string `json:"token"`
}

type GoeConfigSession added in v0.2.1

type GoeConfigSession struct {
	Expiration int    `json:"expiration"`
	KeyLookup  string `json:"key_lookup"`
}

type GoeFiber

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

func NewGoeFiber

func NewGoeFiber(goeConfig *GoeConfig, l contracts.Logger) *GoeFiber

NewGoeFiber creates a new GoeFiber instance.

func (*GoeFiber) App

func (gf *GoeFiber) App() *fiber.App

func (*GoeFiber) CreateFiberApp

func (gf *GoeFiber) CreateFiberApp(appName ...string) *fiber.App

func (*GoeFiber) GoeFiberErrorHandler

func (gf *GoeFiber) GoeFiberErrorHandler(ctx fiber.Ctx, err error) error

type GoeMailer

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

func NewGoeMailer

func NewGoeMailer(appConfig *GoeConfig, queueInstance contracts.Queue, logger contracts.Logger) *GoeMailer

func (*GoeMailer) SMTPSender

func (g *GoeMailer) SMTPSender() contracts.EmailSender

type GoeMongoDB

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

func NewGoeMongoDB

func NewGoeMongoDB(appConfig *GoeConfig, logger mongodb.Logger) (*GoeMongoDB, error)

func (*GoeMongoDB) Aggregate

func (g *GoeMongoDB) Aggregate(model mongodb.IDefaultModel, pipeline any, res any) error

func (*GoeMongoDB) Delete

func (g *GoeMongoDB) Delete(model mongodb.IDefaultModel) error

func (*GoeMongoDB) DeleteMany added in v0.2.0

func (g *GoeMongoDB) DeleteMany(model mongodb.IDefaultModel, filter any) (*omgo.DeleteResult, error)

func (*GoeMongoDB) Find

func (g *GoeMongoDB) Find(model mongodb.IDefaultModel, filter any) omgo.QueryI

func (*GoeMongoDB) FindById

func (g *GoeMongoDB) FindById(model mongodb.IDefaultModel, id string, res any) (bool, error)

func (*GoeMongoDB) FindOne

func (g *GoeMongoDB) FindOne(model mongodb.IDefaultModel, filter any, res any) (bool, error)

func (*GoeMongoDB) FindPage

func (g *GoeMongoDB) FindPage(model mongodb.IDefaultModel, filter any, res any, pageSize int64, currentPage int64, option ...*mongodb.FindPageOption) (totalDoc int64, totalPage int64)

func (*GoeMongoDB) FindWithCursor

func (g *GoeMongoDB) FindWithCursor(model mongodb.IDefaultModel, filter any) omgo.CursorI

func (*GoeMongoDB) Insert

func (*GoeMongoDB) InsertMany

func (g *GoeMongoDB) InsertMany(model mongodb.IDefaultModel, docs []any) (*omgo.InsertManyResult, error)

func (*GoeMongoDB) SetMeilisearch

func (g *GoeMongoDB) SetMeilisearch(meilisearch *msearch.MSearch) error

func (*GoeMongoDB) Update

func (g *GoeMongoDB) Update(model mongodb.IDefaultModel) error

type GoeOIDCConfig

type GoeOIDCConfig struct {
	AppId     string   `json:"app_id"`
	AppSecret string   `json:"app_secret"`
	AppScopes []string `json:"app_scopes"`
	Issuer    string   `json:"issuer"`
}

type GoeQueue

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

func NewGoeQueue

func NewGoeQueue(appConfig *GoeConfig, logger contracts.Logger) (*GoeQueue, error)

func (*GoeQueue) Close

func (g *GoeQueue) Close() error

func (*GoeQueue) NewQueue

func (g *GoeQueue) NewQueue(name contracts.QueueName, handler func(string) bool, cfgs ...*contracts.NewQueueCfg) error

func (*GoeQueue) Push

func (g *GoeQueue) Push(queueName contracts.QueueName, payloadPtr any) error

func (*GoeQueue) PushDelayed

func (g *GoeQueue) PushDelayed(queueName contracts.QueueName, payloadPtr any, delayDuration time.Duration) error

func (*GoeQueue) PushDelayedRaw

func (g *GoeQueue) PushDelayedRaw(queueName contracts.QueueName, payload string, delayDuration time.Duration) error

func (*GoeQueue) PushRaw

func (g *GoeQueue) PushRaw(queueName contracts.QueueName, payload string) error

func (*GoeQueue) PushScheduled

func (g *GoeQueue) PushScheduled(queueName contracts.QueueName, payloadPtr any, t time.Time) error

func (*GoeQueue) PushScheduledRaw

func (g *GoeQueue) PushScheduledRaw(queueName contracts.QueueName, payload string, t time.Time) error

func (*GoeQueue) Start

func (g *GoeQueue) Start() error

Jump to

Keyboard shortcuts

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