Documentation ¶
Index ¶
- Variables
- func RegisterProjectionsAsGroup(repo *eventsourcing.EventRepository, ps ...Projection) *eventsourcing.Group
- func ResetAllProjections(db *sql.DB) error
- func Validate(i interface{}) error
- type AuthenticationDB
- type BaseProjection
- type Chain
- type CommandHandler
- type Error
- type FailSafeProjection
- type Projection
- type Store
- type Token
Constants ¶
This section is empty.
Variables ¶
var ( ErrAuthenticationExpired = NewError("auth_expired", "authentication expired or not found") ErrAuthenticationVerificationFailed = NewError("auth_verification_failed", "authentication verification failed") )
var ( ErrAuthenticationFailed = NewError("auth_failed", "authentication failed") ErrAuthenticationNotVerified = NewError("auth_not_verified", "authentication not verified") )
var ErrInvalidPublicKey = NewError("invalid_public_key", "failed to generate address for this pair of chain and public key")
Functions ¶
func RegisterProjectionsAsGroup ¶
func RegisterProjectionsAsGroup(repo *eventsourcing.EventRepository, ps ...Projection) *eventsourcing.Group
RegisterProjectionsAsGroup registers a group of projections
func ResetAllProjections ¶
ResetAllProjections resets all projections by dropping the projections table
Types ¶
type AuthenticationDB ¶
type AuthenticationDB struct {
// contains filtered or unexported fields
}
AuthenticationDB is a cache for storing authentication tokens
func NewAuthenticationDB ¶
func NewAuthenticationDB() *AuthenticationDB
NewAuthenticationDB creates a new AuthenticationDB
func (*AuthenticationDB) ExtractTokenFromHttp ¶
func (db *AuthenticationDB) ExtractTokenFromHttp(r *http.Request) (Token, error)
ExtractTokenFromHttp extracts an authentication token from the HTTP request Authorization header as a Bearer token
func (*AuthenticationDB) Get ¶
func (a *AuthenticationDB) Get(id uuid.UUID) (Token, error)
Get retrieves an authentication token
type BaseProjection ¶
BaseProjection is a base struct for all projections and queries
func NewBaseProjection ¶
NewBaseProjection creates a new BaseProjection
type CommandHandler ¶
type Error ¶
type Error struct { Code string `json:"code,omitempty"` Message string `json:"message,omitempty"` Internal error `json:"internal,omitempty"` Meta map[string]interface{} `json:"meta,omitempty"` }
Error is a domain error that includes a code, message, meta
func ErrorFromValidationErrors ¶
func ErrorFromValidationErrors(errs validator.ValidationErrors) *Error
ErrorFromValidationErrors creates a domain error from a list of validation errors
func (*Error) IncludeMeta ¶
IncludeMeta includes meta data in the error
type FailSafeProjection ¶
type FailSafeProjection struct {
// contains filtered or unexported fields
}
func NewFailSafeProjection ¶
func NewFailSafeProjection(base Projection, logger zerolog.Logger) *FailSafeProjection
func (*FailSafeProjection) Callback ¶
func (fsp *FailSafeProjection) Callback(event eventsourcing.Event) error
Callback implements the Callback method of the Projection interface
type Projection ¶
type Store ¶
Store is an interface that limits the methods that can be called on a store to All method only
type Token ¶
type Token struct { Id uuid.UUID `json:"id,omitempty"` Chain Chain `json:"chain,omitempty"` Address string `json:"address,omitempty"` IssuedAt int64 `json:"issued_at,omitempty"` ExpiresAt int64 `json:"expires_at,omitempty"` Challenge string `json:"challenge,omitempty"` Verified bool `json:"verified,omitempty"` }
Token represents an authentication token
func (Token) VerifyChallenge ¶
VerifyChallenge verifies the challenge