Documentation ¶
Index ¶
- Constants
- Variables
- func DoTransaction(ctx context.Context, t Transaction, retry int, ...) (err error)
- func Run(ctx context.Context, h Handler, m ...Middleware) (err error)
- func Run1[A any](ctx context.Context, h Handler1[A], m ...Middleware) (a A, err error)
- func Run2[A, B any](ctx context.Context, h Handler2[A, B], m ...Middleware) (a A, b B, err error)
- func Run3[A, B, C any](ctx context.Context, h Handler3[A, B, C], m ...Middleware) (a A, b B, c C, err error)
- type Ctx
- type Cursor
- type CursorPagination
- type Handler
- type Handler1
- type Handler2
- type Handler3
- type Middleware
- type MiddlewareHandler
- type NopTransaction
- type NopTx
- type OffsetPagination
- type OperatableWorkspace
- type Operator
- type PageInfo
- type Pagination
- type Sort
- type Transaction
- type Tx
- type TxUsecase
Constants ¶
View Source
const IDErrTransaction = "transaction error"
Variables ¶
View Source
var ErrPolicyVioration = errors.New("policy violation")
View Source
var (
ErrTransaction = rerror.WrapE(&i18n.Message{ID: IDErrTransaction}, rawErrTransaction)
)
Functions ¶
func DoTransaction ¶
Types ¶
type CursorPagination ¶
type CursorPagination struct { Before *Cursor `json:"before"` After *Cursor `json:"after"` First *int64 `json:"first"` Last *int64 `json:"last"` }
CursorPagination is a struct for Relay-Style Cursor Pagination ref: https://www.apollographql.com/docs/react/features/pagination/#relay-style-cursor-pagination
func (*CursorPagination) Clone ¶
func (p *CursorPagination) Clone() *CursorPagination
func (CursorPagination) Wrap ¶
func (p CursorPagination) Wrap() *Pagination
type Middleware ¶
type Middleware func(next MiddlewareHandler) MiddlewareHandler
func ComposeMiddleware ¶
func ComposeMiddleware(m ...Middleware) Middleware
func UpdateContext ¶
func UpdateContext(f func(ctx context.Context) context.Context) Middleware
type MiddlewareHandler ¶
func ApplyMiddleware ¶
func ApplyMiddleware(h MiddlewareHandler, middleware ...Middleware) MiddlewareHandler
type NopTransaction ¶
type NopTransaction struct { BeginError error CommitError error // contains filtered or unexported fields }
func (*NopTransaction) IsCommitted ¶
func (t *NopTransaction) IsCommitted() bool
type NopTx ¶
type NopTx struct {
// contains filtered or unexported fields
}
func (*NopTx) IsCommitted ¶
type OffsetPagination ¶
func (OffsetPagination) Wrap ¶
func (p OffsetPagination) Wrap() *Pagination
type OperatableWorkspace ¶
type Operator ¶
type Operator struct {
Workspaces []OperatableWorkspace
}
type PageInfo ¶
type PageInfo struct { TotalCount int64 StartCursor *Cursor EndCursor *Cursor HasNextPage bool HasPreviousPage bool }
func EmptyPageInfo ¶
func EmptyPageInfo() *PageInfo
func NewPageInfo ¶
type Pagination ¶
type Pagination struct { Cursor *CursorPagination Offset *OffsetPagination }
func (*Pagination) Clone ¶
func (p *Pagination) Clone() *Pagination
type Tx ¶
type Tx interface { // Context returns a context suitable for use under transaction. Context() context.Context // Commit informs the Tx to commit when End() is called. // If this was not called once, rollback is done when End() is called. Commit() // End finishes the transaction and do commit if Commit() was called once, or else do rollback. // This method is supposed to be called in the uscase layer using defer. End(ctx context.Context) error // IsCommitted returns true if the Tx is marked as committed. IsCommitted() bool }
type TxUsecase ¶
type TxUsecase struct {
Transaction Transaction
}
func (TxUsecase) UseTx ¶
func (t TxUsecase) UseTx() Middleware
func (TxUsecase) UseTxWithRetries ¶
func (t TxUsecase) UseTxWithRetries(retry int) Middleware
Source Files ¶
Click to show internal directories.
Click to hide internal directories.