server

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBLogger

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

DBLogger implements a wrapper around the zerolog Logger type and implements the GORM logging interface.

func NewDBLogger

func NewDBLogger(logger zerolog.Logger) *DBLogger

NewDBLogger creates a new wrapped DBLogger with a given zerolog logger.

func (DBLogger) Error

func (dbl DBLogger) Error(_ context.Context, msg string, data ...interface{})

func (DBLogger) Info

func (dbl DBLogger) Info(_ context.Context, msg string, data ...interface{})

func (*DBLogger) LogMode

func (dbl *DBLogger) LogMode(lvl gormlogger.LogLevel) gormlogger.Interface

LogMode returns a new wrapped zerolog logger with a provided GORM log level which is mapped to a zerolog level.

func (DBLogger) Trace

func (dbl DBLogger) Trace(_ context.Context, _ time.Time, fc func() (string, int64), err error)

func (DBLogger) Warn

func (dbl DBLogger) Warn(_ context.Context, msg string, data ...interface{})

type Service

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

Service implements the encapsulating Atlas service. It wraps a router which is responsible for handling all versioned API requests with a given Router that interacts the with Atlas data model. The Service is responsible for establishing a database connection and managing session cookies.

func NewService

func NewService(logger zerolog.Logger, cfg config.Config) (*Service, error)

func (*Service) Cleanup

func (s *Service) Cleanup()

Cleanup performs server cleanup. If the internal HTTP server is non-nil, the server will be shutdown after a grace period deadline.

func (*Service) GetDB added in v0.0.3

func (s *Service) GetDB() *gorm.DB

GetDB returns the underlying database.

FIXME: We should consider creating the database outside of the server package as an injected dependency.

func (*Service) Start

func (s *Service) Start() error

Start starts the atlas service as a blocking process.

Directories

Path Synopsis
router
v1

Jump to

Keyboard shortcuts

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