Documentation ¶
Index ¶
- Variables
- func RegisterConsensusServer(s grpc.ServiceRegistrar, srv ConsensusServer)
- type AuthReq
- type ConsensusClient
- type ConsensusServer
- type GetUsersReq
- type Project
- func (*Project) Descriptor() ([]byte, []int)deprecated
- func (x *Project) GetCreatedAt() *timestamppb.Timestamp
- func (x *Project) GetDescription() string
- func (x *Project) GetId() int64
- func (x *Project) GetName() string
- func (x *Project) GetOwner() *User
- func (x *Project) GetUpdatedAt() *timestamppb.Timestamp
- func (*Project) ProtoMessage()
- func (x *Project) ProtoReflect() protoreflect.Message
- func (x *Project) Reset()
- func (x *Project) String() string
- type Projects
- type ProjectsReq
- type Role
- type Service
- func (s *Service) AuthenticateUser(ctx context.Context, req *AuthReq) (*User, error)
- func (s *Service) CreateProject(ctx context.Context, project *Project) (*Project, error)
- func (s *Service) CreateUser(ctx context.Context, user *User) (*User, error)
- func (s *Service) GetProjects(ctx context.Context, req *ProjectsReq) (*Projects, error)
- func (s *Service) GetUsers(ctx context.Context, req *GetUsersReq) (*Users, error)
- type UnimplementedConsensusServer
- func (UnimplementedConsensusServer) AuthenticateUser(context.Context, *AuthReq) (*User, error)
- func (UnimplementedConsensusServer) CreateProject(context.Context, *Project) (*Project, error)
- func (UnimplementedConsensusServer) CreateUser(context.Context, *User) (*User, error)
- func (UnimplementedConsensusServer) GetProjects(context.Context, *ProjectsReq) (*Projects, error)
- func (UnimplementedConsensusServer) GetUsers(context.Context, *GetUsersReq) (*Users, error)
- type UnsafeConsensusServer
- type User
- func (*User) Descriptor() ([]byte, []int)deprecated
- func (x *User) GetCreatedAt() *timestamppb.Timestamp
- func (x *User) GetEmail() string
- func (x *User) GetFirstName() string
- func (x *User) GetId() int64
- func (x *User) GetLastName() string
- func (x *User) GetPassword() string
- func (x *User) GetRole() Role
- func (x *User) GetUpdatedAt() *timestamppb.Timestamp
- func (*User) ProtoMessage()
- func (x *User) ProtoReflect() protoreflect.Message
- func (x *User) Reset()
- func (x *User) String() string
- type Users
Constants ¶
This section is empty.
Variables ¶
var ( Role_name = map[int32]string{ 0: "USER", 1: "ADMIN", } Role_value = map[string]int32{ "USER": 0, "ADMIN": 1, } )
Enum value maps for Role.
var Consensus_ServiceDesc = grpc.ServiceDesc{ ServiceName: "service.Consensus", HandlerType: (*ConsensusServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "CreateUser", Handler: _Consensus_CreateUser_Handler, }, { MethodName: "GetUsers", Handler: _Consensus_GetUsers_Handler, }, { MethodName: "AuthenticateUser", Handler: _Consensus_AuthenticateUser_Handler, }, { MethodName: "CreateProject", Handler: _Consensus_CreateProject_Handler, }, { MethodName: "GetProjects", Handler: _Consensus_GetProjects_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "service.proto", }
Consensus_ServiceDesc is the grpc.ServiceDesc for Consensus service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_service_proto protoreflect.FileDescriptor
Functions ¶
func RegisterConsensusServer ¶
func RegisterConsensusServer(s grpc.ServiceRegistrar, srv ConsensusServer)
Types ¶
type AuthReq ¶
type AuthReq struct { // email is the email address of the user. Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` // password is the password of the user. Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` // contains filtered or unexported fields }
AuthReq is the request for authentication.
func (*AuthReq) Descriptor
deprecated
func (*AuthReq) GetPassword ¶
func (*AuthReq) ProtoMessage ¶
func (*AuthReq) ProtoMessage()
func (*AuthReq) ProtoReflect ¶
func (x *AuthReq) ProtoReflect() protoreflect.Message
type ConsensusClient ¶
type ConsensusClient interface { // CreateUser creates a new user. CreateUser(ctx context.Context, in *User, opts ...grpc.CallOption) (*User, error) // GetUsers returns all the existing users. GetUsers(ctx context.Context, in *GetUsersReq, opts ...grpc.CallOption) (*Users, error) // AuthenticateUser authenticates a user. AuthenticateUser(ctx context.Context, in *AuthReq, opts ...grpc.CallOption) (*User, error) // CreateProject creates a new project. CreateProject(ctx context.Context, in *Project, opts ...grpc.CallOption) (*Project, error) // GetProjects returns all the existing projects. GetProjects(ctx context.Context, in *ProjectsReq, opts ...grpc.CallOption) (*Projects, error) }
ConsensusClient is the client API for Consensus service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewConsensusClient ¶
func NewConsensusClient(cc grpc.ClientConnInterface) ConsensusClient
type ConsensusServer ¶
type ConsensusServer interface { // CreateUser creates a new user. CreateUser(context.Context, *User) (*User, error) // GetUsers returns all the existing users. GetUsers(context.Context, *GetUsersReq) (*Users, error) // AuthenticateUser authenticates a user. AuthenticateUser(context.Context, *AuthReq) (*User, error) // CreateProject creates a new project. CreateProject(context.Context, *Project) (*Project, error) // GetProjects returns all the existing projects. GetProjects(context.Context, *ProjectsReq) (*Projects, error) // contains filtered or unexported methods }
ConsensusServer is the server API for Consensus service. All implementations must embed UnimplementedConsensusServer for forward compatibility
type GetUsersReq ¶
type GetUsersReq struct {
// contains filtered or unexported fields
}
GetUsersReq is the request for fetching existing users.
func (*GetUsersReq) Descriptor
deprecated
func (*GetUsersReq) Descriptor() ([]byte, []int)
Deprecated: Use GetUsersReq.ProtoReflect.Descriptor instead.
func (*GetUsersReq) ProtoMessage ¶
func (*GetUsersReq) ProtoMessage()
func (*GetUsersReq) ProtoReflect ¶
func (x *GetUsersReq) ProtoReflect() protoreflect.Message
func (*GetUsersReq) Reset ¶
func (x *GetUsersReq) Reset()
func (*GetUsersReq) String ¶
func (x *GetUsersReq) String() string
type Project ¶
type Project struct { // id is the unique identifier of the project. Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // created_at is the timestamp when the project was created. CreatedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // updated_at is the timestamp when the project was last updated. UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` // name is the name of the project. Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` // description is the description of the project. Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` // owner is the owner of the project. Owner *User `protobuf:"bytes,6,opt,name=owner,proto3" json:"owner,omitempty"` // contains filtered or unexported fields }
Project represents a single project.
func DBProjectToCoreProject ¶
DBProjectToCoreProject converts a database project to a core project.
func DBProjectsToCoreProjects ¶
DBProjectsToCoreProjects converts a one or more database projects to one or more core projects.
func (*Project) Descriptor
deprecated
func (*Project) GetCreatedAt ¶
func (x *Project) GetCreatedAt() *timestamppb.Timestamp
func (*Project) GetDescription ¶
func (*Project) GetUpdatedAt ¶
func (x *Project) GetUpdatedAt() *timestamppb.Timestamp
func (*Project) ProtoMessage ¶
func (*Project) ProtoMessage()
func (*Project) ProtoReflect ¶
func (x *Project) ProtoReflect() protoreflect.Message
type Projects ¶
type Projects struct { // projects is the list of projects. Projects []*Project `protobuf:"bytes,1,rep,name=projects,proto3" json:"projects,omitempty"` // contains filtered or unexported fields }
ProjectsResp is the response containing all the existing projects.
func (*Projects) Descriptor
deprecated
func (*Projects) GetProjects ¶
func (*Projects) ProtoMessage ¶
func (*Projects) ProtoMessage()
func (*Projects) ProtoReflect ¶
func (x *Projects) ProtoReflect() protoreflect.Message
type ProjectsReq ¶
type ProjectsReq struct {
// contains filtered or unexported fields
}
ProjectsReq is the request for fetching existing projects.
func (*ProjectsReq) Descriptor
deprecated
func (*ProjectsReq) Descriptor() ([]byte, []int)
Deprecated: Use ProjectsReq.ProtoReflect.Descriptor instead.
func (*ProjectsReq) ProtoMessage ¶
func (*ProjectsReq) ProtoMessage()
func (*ProjectsReq) ProtoReflect ¶
func (x *ProjectsReq) ProtoReflect() protoreflect.Message
func (*ProjectsReq) Reset ¶
func (x *ProjectsReq) Reset()
func (*ProjectsReq) String ¶
func (x *ProjectsReq) String() string
type Role ¶
type Role int32
Role represents the role of a user.
func (Role) Descriptor ¶
func (Role) Descriptor() protoreflect.EnumDescriptor
func (Role) EnumDescriptor
deprecated
func (Role) Number ¶
func (x Role) Number() protoreflect.EnumNumber
func (Role) Type ¶
func (Role) Type() protoreflect.EnumType
type Service ¶
type Service struct { UnimplementedConsensusServer // contains filtered or unexported fields }
Consensus is the main consensus service.
func (*Service) AuthenticateUser ¶
AuthenticateUser authenticates a user and returns the user if valid.
func (*Service) CreateProject ¶
CreateProject creates a new project.
func (*Service) CreateUser ¶
CreateUser creates a new user.
func (*Service) GetProjects ¶
GetProjects returns all the existing projects.
type UnimplementedConsensusServer ¶
type UnimplementedConsensusServer struct { }
UnimplementedConsensusServer must be embedded to have forward compatible implementations.
func (UnimplementedConsensusServer) AuthenticateUser ¶
func (UnimplementedConsensusServer) CreateProject ¶
func (UnimplementedConsensusServer) CreateUser ¶
func (UnimplementedConsensusServer) GetProjects ¶
func (UnimplementedConsensusServer) GetProjects(context.Context, *ProjectsReq) (*Projects, error)
func (UnimplementedConsensusServer) GetUsers ¶
func (UnimplementedConsensusServer) GetUsers(context.Context, *GetUsersReq) (*Users, error)
type UnsafeConsensusServer ¶
type UnsafeConsensusServer interface {
// contains filtered or unexported methods
}
UnsafeConsensusServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ConsensusServer will result in compilation errors.
type User ¶
type User struct { // id is the unique identifier of the user. Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // created_at is the timestamp when the user was created. CreatedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // updated_at is the timestamp when the user was last updated. UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` // first_name is the first name of the user. FirstName string `protobuf:"bytes,4,opt,name=first_name,json=firstName,proto3" json:"first_name,omitempty"` // last_name is the last name of the user. LastName string `protobuf:"bytes,5,opt,name=last_name,json=lastName,proto3" json:"last_name,omitempty"` // email is the email address of the user. Email string `protobuf:"bytes,6,opt,name=email,proto3" json:"email,omitempty"` // password is the password of the user. Password string `protobuf:"bytes,7,opt,name=password,proto3" json:"password,omitempty"` // role is the role of the user. Role Role `protobuf:"varint,8,opt,name=role,proto3,enum=service.Role" json:"role,omitempty"` // contains filtered or unexported fields }
User represents a single user.
func DBUserToCoreUser ¶
DBUserToCoreUser converts a database user to a core user.
func DBUsersToCoreUsers ¶
DBUsersToCoreUsers converts a one or more database users to one or more core users.
func (*User) Descriptor
deprecated
func (*User) GetCreatedAt ¶
func (x *User) GetCreatedAt() *timestamppb.Timestamp
func (*User) GetFirstName ¶
func (*User) GetLastName ¶
func (*User) GetPassword ¶
func (*User) GetUpdatedAt ¶
func (x *User) GetUpdatedAt() *timestamppb.Timestamp
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
func (*User) ProtoReflect ¶
func (x *User) ProtoReflect() protoreflect.Message
type Users ¶
type Users struct { // users is the list of users. Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"` // contains filtered or unexported fields }
UsersResp is the response containing all the existing users.
func (*Users) Descriptor
deprecated
func (*Users) ProtoMessage ¶
func (*Users) ProtoMessage()
func (*Users) ProtoReflect ¶
func (x *Users) ProtoReflect() protoreflect.Message