Documentation ¶
Index ¶
- func PrepareUserCreatedEvent(user *pb.User) ([]byte, string, error)
- func PrepareUserDeletedEvent(user *pb.User) ([]byte, string, error)
- func PrepareUserEmailUpdatedEvent(userId string, email string) ([]byte, string, error)
- type ConsumerController
- type ServiceConfig
- type ServiceConfigOpts
- type StorageController
- type UserService
- func (svc UserService) RegisterUser(ctx context.Context, req *pb.RegisterUserRequest) (*pb.RegisterUserResponse, error)
- func (svc UserService) ServiceInfo(ctx context.Context, req *commonpb.ServiceInfoRequest) (*commonpb.ServiceInfoResponse, error)
- func (svc UserService) ViewUser(ctx context.Context, req *pb.ViewUserRequest) (*pb.ViewUserResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConsumerController ¶
type ConsumerController interface { messaging.ConsumerController Attach(svc pb.UserServiceServer) }
Interface for event consumption Flexibility for seperate controllers for different messaging systems (e.g. Kafka, NATS, etc)
type ServiceConfig ¶
type ServiceConfig struct { // Core Configuration ServiceOpts ServiceConfigOpts // Dynamically loaded configuration Postgres config.PostgresConfig }
Order Service Configuration
func NewServiceConfig ¶
func NewServiceConfig() (*ServiceConfig, error)
load the base service configuration
type ServiceConfigOpts ¶
type ServiceConfigOpts struct { // Env Var: "AUTH_SERVICE_GRPC" AuthServiceGrpc string }
Service specific config options
func (*ServiceConfigOpts) Load ¶
func (opts *ServiceConfigOpts) Load() error
Load the ServiceConfigOpts
type StorageController ¶
type StorageController interface { GetUser(ctx context.Context, userId string) (*pb.User, error) RegisterUser(ctx context.Context, email string, password string, firstName string, lastName string) (*pb.User, error) UpdateUserEmail(ctx context.Context, userId string, email string) error DeleteUser(ctx context.Context, userId string) (*pb.User, error) }
Interface for database methods Flexibility for implementing seperate controllers for different databases (e.g. Postgres, MongoDB, etc)
type UserService ¶
type UserService struct { pb.UnimplementedUserServiceServer // contains filtered or unexported fields }
Interface for the service
func NewUserService ¶
func NewUserService(cfg *ServiceConfig, store StorageController) *UserService
Create the shipping service
func (UserService) RegisterUser ¶
func (svc UserService) RegisterUser(ctx context.Context, req *pb.RegisterUserRequest) (*pb.RegisterUserResponse, error)
func (UserService) ServiceInfo ¶
func (svc UserService) ServiceInfo(ctx context.Context, req *commonpb.ServiceInfoRequest) (*commonpb.ServiceInfoResponse, error)
func (UserService) ViewUser ¶
func (svc UserService) ViewUser(ctx context.Context, req *pb.ViewUserRequest) (*pb.ViewUserResponse, error)
Click to show internal directories.
Click to hide internal directories.