Documentation
¶
Index ¶
- Constants
- Variables
- func BuildCreate(name string, columns map[string]string) (string, error)
- func BuildInsert(data map[string]interface{}) (string, []interface{}, error)
- func Divide(flatData map[string]interface{}) (columns []string, values []interface{})
- func Enumerate(d []interface{}) string
- type Config
- type ErrNotConfigured
- type PostgresClient
- func (p PostgresClient) Close(ctx context.Context) error
- func (p PostgresClient) CreateMission(ctx context.Context, name string, description string, ...) error
- func (p PostgresClient) GetValues(ctx context.Context, id string) (out []map[string]interface{}, err error)
- func (p PostgresClient) ListMissions(ctx context.Context) (out []map[string]string, err error)
- func (p PostgresClient) MissionInfo(ctx context.Context, id string) (map[string]interface{}, error)
- func (p PostgresClient) Save(ctx context.Context, data map[string]interface{}) error
- func (p PostgresClient) UpdateMission(ctx context.Context, name string, description string) error
Constants ¶
View Source
const ( EnvPostgresHost = "POSTGRES_HOST" EnvPostgresPort = "POSTGRES_PORT" EnvPostgresDB = "POSTGRES_DATABASE" EnvPostgresUsername = "POSTGRES_USERNAME" EnvPostgresPassword = "POSTGRES_PASSWORD" )
Constants containing names of ENV variables
View Source
const ( ConnectionString = `postgresql://{{.Host}}:{{.Port}}/{{.Database}}?user={{.Username}}&password={{.Password}}` DefaultPostgresDB = "sat_dev" DefaultPostgresHost = "postgres" DefaultPostgresPort = "5432" )
Variables ¶
View Source
var ( //go:embed template/mission/create.sql MissionCreateSQL string //go:embed template/mission/info.sql MissionInfoSQL string //go:embed template/mission/select.sql MissionSelectSQL string //go:embed template/missions_registry/create.sql MissionsRegistryCreateSQL string //go:embed template/missions_registry/insert.sql MissionsRegistryInsertSQL string //go:embed template/missions_registry/update.sql MissionsRegistryUpdateSQL string //go:embed template/missions_registry/select.sql MissionsRegistrySelectSQL string //go:embed template/missions_registry/get_columns.sql MissionsRegistryGetColumnsSQL string //go:embed template/missions_registry/select_one.sql MissionsRegistrySelectOneSQL string )
View Source
var (
ErrNoColumns = fmt.Errorf("no columns for the table")
)
Functions ¶
func BuildInsert ¶
Types ¶
type ErrNotConfigured ¶
type ErrNotConfigured struct {
What string
}
func (ErrNotConfigured) Error ¶
func (err ErrNotConfigured) Error() string
func (ErrNotConfigured) Is ¶
func (err ErrNotConfigured) Is(target error) bool
type PostgresClient ¶
func (PostgresClient) CreateMission ¶
func (PostgresClient) ListMissions ¶
func (PostgresClient) MissionInfo ¶
func (PostgresClient) Save ¶
func (p PostgresClient) Save(ctx context.Context, data map[string]interface{}) error
func (PostgresClient) UpdateMission ¶
Click to show internal directories.
Click to hide internal directories.