initsrv

package
v0.0.0-...-a9081ec Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package initsrv will contain all initialization of the required service, repository and handler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitHandler

func InitHandler(ctx context.Context, c *HandlerConfig)

InitHandler will initialize all handler that will be used in the application

Types

type Client

type Client struct {
	Mailer  *mailgun.MailgunImpl
	Discord *discordgo.Session
	Redis   *redis.Client
	MariaDB *ent.Client
}

Client will hold client that will be injected into the Service layer on service initialization

func InitClient

func InitClient(ctx context.Context, logger *otelzap.Logger, conf *configs.Config) *Client

InitClient will initialize all client

func (*Client) CloseClient

func (client *Client) CloseClient(ctx context.Context, logger *otelzap.Logger)

CloseClient will close all client connection

type HandlerConfig

type HandlerConfig struct {
	Logger  *otelzap.Logger
	Conf    *configs.Config
	Router  *gin.Engine
	Service *Service
}

HandlerConfig will hold parameter that will be injected into handler

type Repository

type Repository struct {
	Token   *tokenrepo.Repository
	Mailer  *mailerrepo.Repository
	Admin   *adminrepo.AtomicRepository
	Student *studentrepo.AtomicRepository
}

Repository will hold repository that will be injected into this Service layer on service initialization

func InitRepository

func InitRepository(conf *Client) *Repository

InitRepository will initialize all repository

type Service

type Service struct {
	Student studentservice.Interface
	Mailer  mailerservice.Interface
	Token   tokenservice.Interface
	Admin   adminservice.Interface
}

Service will hold service that will be injected into this Handdler layer on handler initialization

func InitService

func InitService(c *ServiceConfig) *Service

InitService will initialize all service needed by application

type ServiceConfig

type ServiceConfig struct {
	Logger *otelzap.Logger
	Conf   *configs.Config
	Repo   *Repository
	Utils  *UtilsConfig
}

ServiceConfig contain parameter that will be injected into Service layer

type UtilsConfig

type UtilsConfig struct {
	Certs *configs.JWTCertificate
}

UtilsConfig will hold utils that will be injected into Service layer on service initialization

func InitUtils

func InitUtils(ctx context.Context, logger *otelzap.Logger, conf *configs.Config) *UtilsConfig

InitUtils will initialize all utils needed by application

Jump to

Keyboard shortcuts

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