|
| 1 | +// Package postgres defines a server implementation for the DataPlatformServiceServer. |
| 2 | +// This implementation is backed by a PostgreSQL database. |
| 3 | +// |
| 4 | +// Functions and structs for connecting to the database are generated from SQL using |
| 5 | +// the sqlc library, whilst the Server interface that is being implemented comes from |
| 6 | +// the top-level proto definitions. |
| 7 | +package dummy |
| 8 | + |
| 9 | +import ( |
| 10 | + "context" |
| 11 | + |
| 12 | + "github.com/google/uuid" |
| 13 | + |
| 14 | + pb "github.com/openclimatefix/data-platform/internal/gen/ocf/dp" |
| 15 | +) |
| 16 | + |
| 17 | +// --- Server Implementation ---------------------------------------------------------------------- |
| 18 | + |
| 19 | +func NewDataPlatformAdministrationServiceServerImpl() *DataPlatformAdministrationServiceServerImpl { |
| 20 | + return &DataPlatformAdministrationServiceServerImpl{} |
| 21 | +} |
| 22 | + |
| 23 | +type DataPlatformAdministrationServiceServerImpl struct{} |
| 24 | + |
| 25 | +func (d *DataPlatformAdministrationServiceServerImpl) CreateLocationPolicyGroup( |
| 26 | + ctx context.Context, |
| 27 | + req *pb.CreateLocationPolicyGroupRequest, |
| 28 | +) (*pb.CreateLocationPolicyGroupResponse, error) { |
| 29 | + return &pb.CreateLocationPolicyGroupResponse{ |
| 30 | + LocationPolicyGroupId: uuid.New().String(), |
| 31 | + Name: req.Name, |
| 32 | + }, nil |
| 33 | +} |
| 34 | + |
| 35 | +// CreateOrganisation implements dp.DataPlatformAdministrationServiceServer. |
| 36 | +func (d *DataPlatformAdministrationServiceServerImpl) CreateOrganisation( |
| 37 | + ctx context.Context, |
| 38 | + req *pb.CreateOrganisationRequest, |
| 39 | +) (*pb.CreateOrganisationResponse, error) { |
| 40 | + return &pb.CreateOrganisationResponse{ |
| 41 | + OrgId: uuid.New().String(), |
| 42 | + OrgName: req.OrgName, |
| 43 | + }, nil |
| 44 | +} |
| 45 | + |
| 46 | +// CreateUser implements dp.DataPlatformAdministrationServiceServer. |
| 47 | +func (d *DataPlatformAdministrationServiceServerImpl) CreateUser( |
| 48 | + context.Context, |
| 49 | + *pb.CreateUserRequest, |
| 50 | +) (*pb.CreateUserResponse, error) { |
| 51 | + return &pb.CreateUserResponse{ |
| 52 | + UserId: uuid.New().String(), |
| 53 | + }, nil |
| 54 | +} |
| 55 | + |
| 56 | +// DeleteLocationPolicyGroup implements dp.DataPlatformAdministrationServiceServer. |
| 57 | +func (d *DataPlatformAdministrationServiceServerImpl) DeleteLocationPolicyGroup( |
| 58 | + context.Context, |
| 59 | + *pb.DeleteLocationPolicyGroupRequest, |
| 60 | +) (*pb.DeleteLocationPolicyGroupResponse, error) { |
| 61 | + return &pb.DeleteLocationPolicyGroupResponse{}, nil |
| 62 | +} |
| 63 | + |
| 64 | +// DeleteOrganisation implements dp.DataPlatformAdministrationServiceServer. |
| 65 | +func (d *DataPlatformAdministrationServiceServerImpl) DeleteOrganisation( |
| 66 | + context.Context, |
| 67 | + *pb.DeleteOrganisationRequest, |
| 68 | +) (*pb.DeleteOrganisationResponse, error) { |
| 69 | + return &pb.DeleteOrganisationResponse{}, nil |
| 70 | +} |
| 71 | + |
| 72 | +// DeleteUser implements dp.DataPlatformAdministrationServiceServer. |
| 73 | +func (d *DataPlatformAdministrationServiceServerImpl) DeleteUser( |
| 74 | + context.Context, |
| 75 | + *pb.DeleteUserRequest, |
| 76 | +) (*pb.DeleteUserResponse, error) { |
| 77 | + return &pb.DeleteUserResponse{}, nil |
| 78 | +} |
| 79 | + |
| 80 | +// GetLocationPolicyGroup implements dp.DataPlatformAdministrationServiceServer. |
| 81 | +func (d *DataPlatformAdministrationServiceServerImpl) GetLocationPolicyGroup( |
| 82 | + context.Context, |
| 83 | + *pb.GetLocationPolicyGroupRequest, |
| 84 | +) (*pb.GetLocationPolicyGroupResponse, error) { |
| 85 | + panic("unimplemented") |
| 86 | +} |
| 87 | + |
| 88 | +// GetOrganisation implements dp.DataPlatformAdministrationServiceServer. |
| 89 | +func (d *DataPlatformAdministrationServiceServerImpl) GetOrganisation( |
| 90 | + context.Context, |
| 91 | + *pb.GetOrganisationRequest, |
| 92 | +) (*pb.GetOrganisationResponse, error) { |
| 93 | + panic("unimplemented") |
| 94 | +} |
| 95 | + |
| 96 | +// GetUser implements dp.DataPlatformAdministrationServiceServer. |
| 97 | +func (d *DataPlatformAdministrationServiceServerImpl) GetUser( |
| 98 | + context.Context, |
| 99 | + *pb.GetUserRequest, |
| 100 | +) (*pb.GetUserResponse, error) { |
| 101 | + panic("unimplemented") |
| 102 | +} |
| 103 | + |
| 104 | +// UpdateLocationPolicyGroup implements dp.DataPlatformAdministrationServiceServer. |
| 105 | +func (d *DataPlatformAdministrationServiceServerImpl) UpdateLocationPolicyGroup( |
| 106 | + context.Context, |
| 107 | + *pb.UpdateLocationPolicyGroupRequest, |
| 108 | +) (*pb.UpdateLocationPolicyGroupResponse, error) { |
| 109 | + panic("unimplemented") |
| 110 | +} |
| 111 | + |
| 112 | +// UpdateOrganisation implements dp.DataPlatformAdministrationServiceServer. |
| 113 | +func (d *DataPlatformAdministrationServiceServerImpl) UpdateOrganisation( |
| 114 | + context.Context, |
| 115 | + *pb.UpdateOrganisationRequest, |
| 116 | +) (*pb.UpdateOrganisationResponse, error) { |
| 117 | + panic("unimplemented") |
| 118 | +} |
| 119 | + |
| 120 | +// Compile-time check to ensure the interface is implemented fully. |
| 121 | +var _ pb.DataPlatformAdministrationServiceServer = (*DataPlatformAdministrationServiceServerImpl)( |
| 122 | + nil, |
| 123 | +) |
0 commit comments