service

package
v0.0.0-...-404d8b9 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Errors = struct {
	InitConfigError   error
	DBConnectionError error
}{}

Functions

func GetDBConnection

func GetDBConnection() *sql.DB

func RenderSchemaTemplate

func RenderSchemaTemplate() error

func SyncEntityWithSchema

func SyncEntityWithSchema() ([]byte, error)

Types

type ApplySchemaResult

type ApplySchemaResult struct {
	Changes SchemaChanges `json:"Changes,omitempty"`
}

func SyncDBWithSchema

func SyncDBWithSchema(dryRun bool) (*ApplySchemaResult, error)

func (*ApplySchemaResult) String

func (res *ApplySchemaResult) String() string

type Config

type Config struct {
	Service struct {
		Name string `yaml:"name" envconfig:"SERVICE_NAME"`
		Env  string `yaml:"env" envconfig:"SERVICE_ENV"`
	} `yaml:"service"`
	Server struct {
		Port int `yaml:"port" envconfig:"SERVER_PORT"`
	} `yaml:"server"`
	Database struct {
		Host string `yaml:"host" envconfig:"DB_HOST"`
		Port int    `yaml:"port" envconfig:"DB_PORT"`
		Name string `yaml:"name" envconfig:"DB_NAME"`
		User string `yaml:"user" envconfig:"DB_USER"`
		Pass string `yaml:"pass" envconfig:"DB_PASS"`
	} `yaml:"database"`
	OpenTelemtry struct {
		Host     string `yaml:"host" envconfig:"OPENTELEMTRY_HOST"`
		Insecure bool   `yaml:"insecure" envconfig:"OPENTELEMTRY_INSECURE"`
	} `yaml:"opentelemtry"`
}

func GetConfig

func GetConfig() Config

type SchemaChanges

type SchemaChanges struct {
	Pending []string `json:"Pending,omitempty"`
	Applied []string `json:"Applied,omitempty"`
}

Jump to

Keyboard shortcuts

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