common

package
v0.0.0-...-2a68481 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrorServiceMissingParameter used when one or more parameters are missing
	ErrorServiceMissingParameter = errors.New("Parameter is missing")
	// ErrorServiceUserNotActive used when a user does not exist
	ErrorServiceUserNotActive = errors.New("User not active")
	// ErrorServiceNoSuchFlight no such flight exists
	ErrorServiceNoSuchFlight = errors.New("No such flight")
	// ErrorServiceNoSuchLocation when the location does not exist
	ErrorServiceNoSuchLocation = errors.New("No such location")
	// ErrorServiceBadCoordinates when coordinates are wrong
	ErrorServiceBadCoordinates = errors.New("Invalid coordinate set")

	ErrorServiceBadDirectionSet = errors.New("The given wind directions are not valid")
)

Functions

func CreateConnectionString

func CreateConnectionString(username string, password string, hostname string, port string, database string) string

CreateConnectionString creates a MySql / MariaDB connection string from parameters hostname and database can be empty strings

func CreateGormContext

func CreateGormContext(username string, password string, hostname string, port string, database string) (*gorm.DB, error)

func EnsureDatabaseExists

func EnsureDatabaseExists(username string, password string, hostname string, port string, database string) error

EnsureDatabaseExists creates a connection with the given parameters and creates the given database-name if not present

Types

type ServiceConfig

type ServiceConfig struct {
	UserserviceUrl  string
	UserservicePort string
	Mode            string
}

ServiceConfig describes service wide config parameters

func (*ServiceConfig) IsDevMode

func (s *ServiceConfig) IsDevMode() bool

IsDevMode returns true if application is in devmode

type Timestamp

type Timestamp struct {
	UpdatedAt *time.Time `gorm:"column:updatedat;type:time"`
	CreatedAt *time.Time `gorm:"column:createdat;type:time"`
	DeletedAt *time.Time `gorm:"column:deletedat;type:time"`
}

Jump to

Keyboard shortcuts

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