Documentation ¶
Index ¶
- Variables
- func DBQueryJSON(ctx context.Context, db hub.DB, query string, args ...interface{}) ([]byte, error)
- func DBQueryUnmarshal(ctx context.Context, db hub.DB, v interface{}, query string, ...) error
- func DBTransact(ctx context.Context, db hub.DB, txFunc func(pgx.Tx) error) (err error)
- func SetupConfig(cmd string) (*viper.Viper, error)
- func SetupDB(cfg *viper.Viper) (*pgxpool.Pool, error)
- func SetupImageStore(cfg *viper.Viper, db pg.DB, hc img.HTTPClient, githubRL *rate.Limiter) (img.Store, error)
- func SetupLogger(cfg *viper.Viper, fields map[string]interface{}) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrDBInsufficientPrivilege indicates that the user does not have the // required privilege to perform the operation. ErrDBInsufficientPrivilege = errors.New("ERROR: insufficient_privilege (SQLSTATE 42501)") )
Functions ¶
func DBQueryJSON ¶ added in v0.7.0
DBQueryJSON is a helper that executes the query provided and returns a bytes slice containing the json data returned from the database.
func DBQueryUnmarshal ¶ added in v0.7.0
func DBQueryUnmarshal(ctx context.Context, db hub.DB, v interface{}, query string, args ...interface{}) error
DBQueryUnmarshal is a helper that executes the query provided and unmarshals the json data returned from the database into the value (v) provided.
func DBTransact ¶
DBTransact is a helper function that wraps some database transactions taking care of committing and rolling back when needed.
func SetupConfig ¶
SetupConfig creates a new Viper instance to handle the configuration for a particular cmd. Configuration can be provided in a config file or using env variables. See configs folder for some examples.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.