package main import ( "forge.cadoles.com/Cadoles/daddy/internal/command" "forge.cadoles.com/Cadoles/daddy/internal/query" "github.com/pkg/errors" "gitlab.com/wpetit/goweb/cqrs" "gitlab.com/wpetit/goweb/service" ) func initCommands(ctn *service.Container) error { dispatcher, err := cqrs.From(ctn) if err != nil { return errors.WithStack(err) } dispatcher.RegisterCommand( cqrs.MatchCommandRequest(&command.CreateUserCommandRequest{}), cqrs.CommandHandlerFunc(command.HandleCreateUserCommand), ) return nil } func initQueries(ctn *service.Container) error { dispatcher, err := cqrs.From(ctn) if err != nil { return errors.WithStack(err) } dispatcher.RegisterQuery( cqrs.MatchQueryRequest(&query.FindUserQueryRequest{}), cqrs.QueryHandlerFunc(query.HandleFindUserQuery), ) return nil }