user

package
v0.0.0-...-531b5da Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrepareUserCreatedEvent

func PrepareUserCreatedEvent(user *pb.User) ([]byte, string, error)

func PrepareUserDeletedEvent

func PrepareUserDeletedEvent(user *pb.User) ([]byte, string, error)

func PrepareUserEmailUpdatedEvent

func PrepareUserEmailUpdatedEvent(userId string, email string) ([]byte, string, error)

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
	Shared      config.SharedConfig
	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 (UserService) ServiceInfo

func (UserService) ViewUser

func (svc UserService) ViewUser(ctx context.Context, req *pb.ViewUserRequest) (*pb.ViewUserResponse, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL