Documentation ¶
Index ¶
- func AppendIfMissingInt64(slice []int64, i int64) []int64
- func EpochToHumanReadable(epoch int64) string
- func GetMessageForHTTPStatus(statusCode int) string
- func IntSliceToCommaSeparatedString(data []int64) string
- type ApplicationDatabase
- type ApplicationHTTPHandler
- type MockApplicationDatabase
- func (mdb MockApplicationDatabase) Begin(ctx context.Context) (pgx.Tx, error)
- func (mdb *MockApplicationDatabase) CalledWith() []interface{}
- func (mdb MockApplicationDatabase) Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)
- func (mdb MockApplicationDatabase) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
- type MockRow
- type MockRows
- func (mr MockRows) Close()
- func (mr MockRows) CommandTag() pgconn.CommandTag
- func (mr MockRows) Err() error
- func (mr MockRows) FieldDescriptions() []pgproto3.FieldDescription
- func (mr MockRows) Next() bool
- func (mr MockRows) RawValues() [][]byte
- func (mr MockRows) Scan(dest ...interface{}) error
- func (mr MockRows) Values() ([]interface{}, error)
- type MockTx
- func (mtx MockTx) Begin(ctx context.Context) (pgx.Tx, error)
- func (mtx MockTx) BeginFunc(ctx context.Context, f func(pgx.Tx) error) (err error)
- func (mtx MockTx) Commit(ctx context.Context) error
- func (mtx MockTx) Conn() *pgx.Conn
- func (mtx MockTx) CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, ...) (int64, error)
- func (mtx MockTx) Exec(ctx context.Context, sql string, arguments ...interface{}) (commandTag pgconn.CommandTag, err error)
- func (mtx MockTx) LargeObjects() pgx.LargeObjects
- func (mtx MockTx) Prepare(ctx context.Context, name, sql string) (*pgconn.StatementDescription, error)
- func (mtx MockTx) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
- func (mtx MockTx) QueryFunc(ctx context.Context, sql string, args []interface{}, scans []interface{}, ...) (pgconn.CommandTag, error)
- func (mtx MockTx) QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row
- func (mtx MockTx) Rollback(ctx context.Context) error
- func (mtx MockTx) SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendIfMissingInt64 ¶
AppendIfMissingInt64 will append to an int64 slice if the wanted element is missing.
func EpochToHumanReadable ¶
EpochToHumanReadable will return a RFC822 format date time string from a Unix epoch.
func GetMessageForHTTPStatus ¶
GetMessageForHTTPStatus will return an appropriate string based on the given HTTP status code.
func IntSliceToCommaSeparatedString ¶
IntSliceToCommaSeparatedString will convert a slice of int64 items into a comma separated string.
Types ¶
type ApplicationDatabase ¶
type ApplicationDatabase interface { Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error) Begin(ctx context.Context) (pgx.Tx, error) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error) }
ApplicationDatabase represents the application's database contract, any object implementing the contract can be used as the application's database.
type ApplicationHTTPHandler ¶
type ApplicationHTTPHandler interface { Handle(httpMethod, relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes ServeHTTP(http.ResponseWriter, *http.Request) Use(middleware ...gin.HandlerFunc) gin.IRoutes Static(relativePath, root string) gin.IRoutes Group(relativePath string, handlers ...gin.HandlerFunc) *gin.RouterGroup }
ApplicationHTTPHandler represents the application's router contract, any object implementing the contract can be used as the application's HTTP router.
type MockApplicationDatabase ¶
type MockApplicationDatabase struct {
// contains filtered or unexported fields
}
func (MockApplicationDatabase) Begin ¶
func (mdb MockApplicationDatabase) Begin(ctx context.Context) (pgx.Tx, error)
func (*MockApplicationDatabase) CalledWith ¶
func (mdb *MockApplicationDatabase) CalledWith() []interface{}
func (MockApplicationDatabase) Exec ¶
func (mdb MockApplicationDatabase) Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)
type MockRows ¶
type MockRows struct{}
func (MockRows) CommandTag ¶
func (mr MockRows) CommandTag() pgconn.CommandTag
func (MockRows) FieldDescriptions ¶
func (mr MockRows) FieldDescriptions() []pgproto3.FieldDescription