Versions in this module Expand all Collapse all v0 v0.1.0 Nov 1, 2024 Changes in this version + const CtxKeyHttpRequest + const PostgresTxConnKey + func CtxWithHttpRequest(ctx context.Context, req *http.Request) context.Context + func CtxWithTx(ctx context.Context, sqlConn sqlx.SqlConn) context.Context + func DbErr(err error, msg ...string) error + func EncodeSSEEvent(w io.Writer, e *SSEEvent) error + func ErrHandler(ctx context.Context, err error) (int, any) + func HostPortFromCtx(ctx context.Context) (host string, port string) + func HttpRequestFromCtx(ctx context.Context) (*http.Request, bool) + func InitSqlConn(cfg DatabaseConf) error + func JwtDataAuthTokenFromCtx(ctx context.Context) string + func JwtDataEmailFromCtx(ctx context.Context) string + func JwtDataFromCtx(ctx context.Context) (userId int64, uid string, email string, authToken string) + func JwtDataUidFromCtx(ctx context.Context) string + func JwtDataUserIdFromCtx(ctx context.Context) int64 + func OkResponseHandler(ctx context.Context, v any) any + func PingDb(ctx context.Context) error + func RemoteAddrFromCtx(ctx context.Context) string + func RemoveTxFromCtx(ctx context.Context) context.Context + func TxFromCtx(ctx context.Context) (sqlConn sqlx.SqlConn, exists bool) + func WithNewTx(ctx context.Context, fn func(context.Context, sqlx.SqlConn) error) error + func WithTx(ctx context.Context, fn func(context.Context, sqlx.SqlConn) error) error + func WriteJsonResponse(ctx context.Context, w http.ResponseWriter, v any, err error) + type BootTask struct + func NewBootTask[T any](ctx context.Context, cfg T, name string, ...) *BootTask[T] + func (t *BootTask[T]) Start() error + func (t *BootTask[T]) StartAsync() (done chan error) + type DatabaseConf struct + Dsn string + MigrationsDir string + type SSEEvent struct + Data []byte + Event string + Id string + Retry uint64 + type SSEStream struct + func NewSSEStream(w http.ResponseWriter, r *http.Request) *SSEStream + func (s *SSEStream) Publish(event *SSEEvent) error