starter

package
v0.0.0-...-54e45cf Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewApiRouter

func NewApiRouter(app *App) (*gin.RouterGroup, error)

func NewDb

func NewDb(dbConf *config.DatabaseConfig) (*gorm.DB, error)

func NewEngine

func NewEngine(app *App) (*gin.Engine, error)

func NewRedis

func NewRedis(redisConfig *config.RedisConfig) (redis.Store, error)

func NewZapLogger

func NewZapLogger(zapConfig *zap.Config) (*zap.Logger, error)

func StaticRoutes

func StaticRoutes(app *App) error

Types

type APIRouter

type APIRouter interface {
	RegisterRoutes(router *gin.RouterGroup)
	Initialize(config *config.Config, bizStore *biz.BizStore, logger *zap.Logger) error
}

type App

type App struct {
	Config     *config.Config
	DB         *gorm.DB
	DataStore  *data.DataStore
	BizStore   *biz.BizStore
	RedisStore redis.Store

	Logger       *zap.Logger
	TokenService *utils.JWT
	Engine       *gin.Engine
	// contains filtered or unexported fields
}

func NewApp

func NewApp(v *viper.Viper) (*App, error)

func (*App) AddRouters

func (a *App) AddRouters(routers ...APIRouter)

func (*App) Run

func (a *App) Run() error

type Controller

type Controller interface {
	RegisterRoutes(router *gin.Engine)
}

type HttpServer

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

func NewHttpServer

func NewHttpServer(app *App) (*HttpServer, error)

func (*HttpServer) ListenAndServe

func (s *HttpServer) ListenAndServe() error

type Server

type Server interface {
	ListenAndServe() error
}

Jump to

Keyboard shortcuts

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