service

package
v0.0.0-...-9004257 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConnection

func GetConnection() (*pgxpool.Pool, error)

GetConnection allows us to retrieve the database connection easier

Types

type App

type App struct {
	Config   *Config
	Database *Database
	Server   *Server
}

App manages the application settings and configuration

func NewApp

func NewApp() (*App, error)

NewApp creates a new app

type Config

type Config struct {
	Database struct {
		Host         string
		Port         int
		User         string
		Password     string
		Sslmode      string
		Dbname       string
		MigrateTable string `yaml:"migrateTable"`
	}
}

Config config to run gatherfi

func GetConfig

func GetConfig() (*Config, error)

GetConfig allows us to retrieve the config easier

func NewConfig

func NewConfig() (*Config, error)

NewConfig attempts to get the config and read it

func (*Config) GetConnectionString

func (config *Config) GetConnectionString(dbName interface{}) string

GetConnectionString returns the connection string for the database

type Database

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

Database structure for handling database operations

func GetDatabase

func GetDatabase() (*Database, error)

GetDatabase allows us to retrieve the database easier

func NewDatabase

func NewDatabase(connString string) (*Database, error)

NewDatabase creates a Database object and connects to database

func (*Database) Close

func (db *Database) Close()

Close closes the running database

func (*Database) Connect

func (db *Database) Connect() error

Connect will open the connection and attempt to contact the server

func (*Database) SetConnectionString

func (db *Database) SetConnectionString(connString string)

SetConnectionString will terminate any previous database connection

type Server

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

Server structure for handling data requests

func NewServer

func NewServer() (*Server, error)

NewServer creates a new server structure

func (*Server) SetHandler

func (server *Server) SetHandler(handler http.Handler)

SetHandler setter to initialize the handler

func (*Server) StartServer

func (server *Server) StartServer() error

StartServer starts the webserver and waits for signal to shutdown

Jump to

Keyboard shortcuts

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