Documentation ¶
Index ¶
- func MongoDbEmployeeToEmployee(e *MongoDbEmployee) (*domain.Employee, error)
- func MongoDbEmployeesToEmployees(mongoDbEmployees []MongoDbEmployee) ([]domain.Employee, error)
- type DatabaseError
- type EmployeesMongoDBRepository
- func (r *EmployeesMongoDBRepository) Add(ctx context.Context, employee domain.Employee) (*domain.Employee, error)
- func (r *EmployeesMongoDBRepository) Close() error
- func (r *EmployeesMongoDBRepository) GetAll(ctx context.Context) ([]domain.Employee, error)
- func (r *EmployeesMongoDBRepository) GetById(ctx context.Context, id string) (*domain.Employee, error)
- func (r *EmployeesMongoDBRepository) ModifyById(ctx context.Context, id string, employee domain.Employee) (*domain.Employee, error)
- func (r *EmployeesMongoDBRepository) RemoveById(ctx context.Context, id string) (*domain.Employee, error)
- type EmployeesRepository
- type MongoDbEmployee
- type NotFoundError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MongoDbEmployeeToEmployee ¶
func MongoDbEmployeeToEmployee(e *MongoDbEmployee) (*domain.Employee, error)
func MongoDbEmployeesToEmployees ¶
func MongoDbEmployeesToEmployees(mongoDbEmployees []MongoDbEmployee) ([]domain.Employee, error)
Types ¶
type DatabaseError ¶
func (*DatabaseError) Error ¶
func (e *DatabaseError) Error() string
type EmployeesMongoDBRepository ¶
type EmployeesMongoDBRepository struct {
// contains filtered or unexported fields
}
func (*EmployeesMongoDBRepository) Close ¶
func (r *EmployeesMongoDBRepository) Close() error
func (*EmployeesMongoDBRepository) ModifyById ¶
func (*EmployeesMongoDBRepository) RemoveById ¶
type EmployeesRepository ¶
type EmployeesRepository interface { GetAll(ctx context.Context) ([]domain.Employee, error) Add(ctx context.Context, employee domain.Employee) (*domain.Employee, error) GetById(ctx context.Context, id string) (*domain.Employee, error) ModifyById(ctx context.Context, id string, employee domain.Employee) (*domain.Employee, error) RemoveById(ctx context.Context, id string) (*domain.Employee, error) Close() error }
type MongoDbEmployee ¶
type MongoDbEmployee struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` Name string `json:"name"` Salary primitive.Decimal128 `json:"salary"` Age int `json:"age"` }
func EmployeeToMongoDbEmployee ¶
func EmployeeToMongoDbEmployee(e *domain.Employee) (*MongoDbEmployee, error)
type NotFoundError ¶
type NotFoundError struct {
ID string
}
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
Click to show internal directories.
Click to hide internal directories.