util

package
v0.0.0-...-82d3620 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateErrorJSON

func CreateErrorJSON(message string) string

CreateErrorJSON returns a JSON string containing the key error associated with provided value

func ExtractIDFromRequest

func ExtractIDFromRequest(requestParams map[string]string) (uuid.UUID, error)

ExtractIDFromRequest extracts the parameter provided under parameter ID and converts it into a uuid

func ExtractPictureIDFromRequest

func ExtractPictureIDFromRequest(requestParams map[string]string) (uuid.UUID, error)

ExtractPictureIDFromRequest extracts the parameter provided under parameter picture_id and converts it into a uuid

Types

type Auth

type Auth struct {
	ID uuid.UUID
}

Auth contains the unique identifier for a given auth

func ExtractAuthIDFromRequest

func ExtractAuthIDFromRequest(headers http.Header) (*Auth, error)

ExtractAuthIDFromRequest extracts a token from a header of the form `Authorization: Bearer <token>`

type Config

type Config struct {
	User     string            `json:"user"`
	DBName   string            `json:"dbName"`
	Host     string            `json:"host"`
	SSLMode  string            `json:"sslMode"`
	Services map[string]string `json:"services"`
	Ports    map[string]int    `json:"ports"`
}

func GetConfig

func GetConfig(filePath string) (*Config, error)

GetConfig returns a configuration object from decoding the given configuration file

Jump to

Keyboard shortcuts

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