Documentation ¶
Overview ¶
Package handler implements service handlers. Handlers are not bound to a specific server transport like http or nats, instead they take a context and a request proto buf as inputs. http and other transports.
New handler constructors are expected to take in dependencies provided by other packages like connected database clients, loggers, tracers, etc...
Index ¶
- Constants
- func OrganizationToRPC(org *ent.Organization) *holos.Organization
- func PlatformToRPC(entity *ent.Platform) *platform.Platform
- func UserToRPC(entity *ent.User) *holos.User
- func WithTx(ctx context.Context, client *ent.Client, fn func(tx *ent.Tx) error) error
- type OrganizationHandler
- func (h *OrganizationHandler) CreateOrganization(ctx context.Context, req *connect.Request[holos.CreateOrganizationRequest]) (*connect.Response[holos.CreateOrganizationResponse], error)
- func (h *OrganizationHandler) ListOrganizations(ctx context.Context, req *connect.Request[holos.ListOrganizationsRequest]) (*connect.Response[holos.ListOrganizationsResponse], error)
- type PlatformHandler
- func (h *PlatformHandler) CreatePlatform(ctx context.Context, req *connect.Request[platform.CreatePlatformRequest]) (*connect.Response[platform.CreatePlatformResponse], error)
- func (h *PlatformHandler) DeletePlatform(ctx context.Context, req *connect.Request[platform.DeletePlatformRequest]) (*connect.Response[platform.DeletePlatformResponse], error)
- func (h *PlatformHandler) GetPlatform(ctx context.Context, req *connect.Request[platform.GetPlatformRequest]) (*connect.Response[platform.GetPlatformResponse], error)
- func (h *PlatformHandler) ListPlatforms(ctx context.Context, req *connect.Request[platform.ListPlatformsRequest]) (*connect.Response[platform.ListPlatformsResponse], error)
- func (h *PlatformHandler) UpdatePlatform(ctx context.Context, req *connect.Request[platform.UpdatePlatformRequest]) (*connect.Response[platform.UpdatePlatformResponse], error)
- type SystemHandler
- func (h *SystemHandler) DropTables(ctx context.Context, req *connect.Request[system.DropTablesRequest]) (*connect.Response[system.DropTablesResponse], error)
- func (h *SystemHandler) GetVersion(ctx context.Context, req *connect.Request[system.GetVersionRequest]) (*connect.Response[system.GetVersionResponse], error)
- func (h *SystemHandler) SeedDatabase(ctx context.Context, req *connect.Request[system.SeedDatabaseRequest]) (*connect.Response[system.SeedDatabaseResponse], error)
- type UserHandler
- func (h *UserHandler) CreateUser(ctx context.Context, req *connect.Request[holos.CreateUserRequest]) (*connect.Response[holos.CreateUserResponse], error)
- func (h *UserHandler) GetUser(ctx context.Context, req *connect.Request[holos.GetUserRequest]) (*connect.Response[holos.GetUserResponse], error)
- func (h *UserHandler) RegisterUser(ctx context.Context, req *connect.Request[holos.RegisterUserRequest]) (*connect.Response[holos.RegisterUserResponse], error)
Constants ¶
const BareForm = `` /* 21812-byte string literal not displayed */
const Model = `{"model":{}}`
Variables ¶
This section is empty.
Functions ¶
func OrganizationToRPC ¶
func OrganizationToRPC(org *ent.Organization) *holos.Organization
OrganizationToRPC returns an *holos.Organization adapted from *ent.Organization u.
Types ¶
type OrganizationHandler ¶
type OrganizationHandler struct {
// contains filtered or unexported fields
}
OrganizationHandler implements the OrganizationService interface.
func NewOrganizationHandler ¶
func NewOrganizationHandler(db *ent.Client) *OrganizationHandler
NewOrganizationHandler returns a new OrganizationService implementation.
func (*OrganizationHandler) CreateOrganization ¶
func (h *OrganizationHandler) CreateOrganization( ctx context.Context, req *connect.Request[holos.CreateOrganizationRequest], ) (*connect.Response[holos.CreateOrganizationResponse], error)
func (*OrganizationHandler) ListOrganizations ¶
func (h *OrganizationHandler) ListOrganizations(ctx context.Context, req *connect.Request[holos.ListOrganizationsRequest]) (*connect.Response[holos.ListOrganizationsResponse], error)
type PlatformHandler ¶
type PlatformHandler struct {
// contains filtered or unexported fields
}
PlatformHandler implements the PlatformService interface.
func NewPlatformHandler ¶
func NewPlatformHandler(db *ent.Client) *PlatformHandler
NewPlatformHandler returns a new PlatformService implementation.
func (*PlatformHandler) CreatePlatform ¶
func (h *PlatformHandler) CreatePlatform(ctx context.Context, req *connect.Request[platform.CreatePlatformRequest]) (*connect.Response[platform.CreatePlatformResponse], error)
CreatePlatform implements the PlatformService CreatePlatform rpc method.
func (*PlatformHandler) DeletePlatform ¶ added in v0.90.0
func (h *PlatformHandler) DeletePlatform(ctx context.Context, req *connect.Request[platform.DeletePlatformRequest]) (*connect.Response[platform.DeletePlatformResponse], error)
func (*PlatformHandler) GetPlatform ¶
func (h *PlatformHandler) GetPlatform(ctx context.Context, req *connect.Request[platform.GetPlatformRequest]) (*connect.Response[platform.GetPlatformResponse], error)
GetPlatform implements the PlatformService GetPlatform rpc method.
func (*PlatformHandler) ListPlatforms ¶
func (h *PlatformHandler) ListPlatforms(ctx context.Context, req *connect.Request[platform.ListPlatformsRequest]) (*connect.Response[platform.ListPlatformsResponse], error)
ListPlatforms implements the PlatformService ListPlatforms rpc method.
func (*PlatformHandler) UpdatePlatform ¶
func (h *PlatformHandler) UpdatePlatform( ctx context.Context, req *connect.Request[platform.UpdatePlatformRequest], ) (*connect.Response[platform.UpdatePlatformResponse], error)
type SystemHandler ¶
type SystemHandler struct {
// contains filtered or unexported fields
}
SystemHandler implements the PlatformService interface.
func NewSystemHandler ¶
func NewSystemHandler(db *ent.Client) *SystemHandler
NewSystemHandler returns a new SystemService implementation.
func (*SystemHandler) DropTables ¶
func (h *SystemHandler) DropTables(ctx context.Context, req *connect.Request[system.DropTablesRequest]) (*connect.Response[system.DropTablesResponse], error)
func (*SystemHandler) GetVersion ¶
func (h *SystemHandler) GetVersion(ctx context.Context, req *connect.Request[system.GetVersionRequest]) (*connect.Response[system.GetVersionResponse], error)
func (*SystemHandler) SeedDatabase ¶
func (h *SystemHandler) SeedDatabase(ctx context.Context, req *connect.Request[system.SeedDatabaseRequest]) (*connect.Response[system.SeedDatabaseResponse], error)
type UserHandler ¶
type UserHandler struct {
// contains filtered or unexported fields
}
UserHandler implements the UserService interface.
func NewUserHandler ¶
func NewUserHandler(db *ent.Client) *UserHandler
NewUserHandler returns a new UserService implementation.
func (*UserHandler) CreateUser ¶
func (h *UserHandler) CreateUser(ctx context.Context, req *connect.Request[holos.CreateUserRequest]) (*connect.Response[holos.CreateUserResponse], error)
func (*UserHandler) GetUser ¶
func (h *UserHandler) GetUser(ctx context.Context, req *connect.Request[holos.GetUserRequest]) (*connect.Response[holos.GetUserResponse], error)
func (*UserHandler) RegisterUser ¶
func (h *UserHandler) RegisterUser(ctx context.Context, req *connect.Request[holos.RegisterUserRequest]) (*connect.Response[holos.RegisterUserResponse], error)