staffing

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: MIT Imports: 2 Imported by: 0

README

Staffing Service

Go Reference Latest Release Go Report Card

This is an example of a staffing service for a fictional consulting company. It is an implementation of Domain Driven Design and Clean Architecture.

The service uses CQRS and Event Sourcing to implement the business logic. The service is implemented in Go.

The structure of the service is based off github.com/marcusolsson/goddd by Marcus Olsson.

Usage

# Clone the repository
gh repo clone brittonhayes/staffing

# Run the service with default settings
go run ./cmd/staffd/main.go
Configuration

The service can be run with a few different customization options. These options can be set with environment variables or command line flags.

# OR run the service with in-memory storage and debug logging
go run ./cmd/staffd/main.go -inmem -debug
# OR run the service with BoltDB storage and debug logging
go run ./cmd/staffd/main.go -debug

Docker

# Build the image
docker build -t ghcr.io/brittonhayes/staffing:latest .

# Run the image
docker run ghcr.io/brittonhayes/staffing:latest

Development

# Clone the repository
gh repo clone brittonhayes/staffing
cd ./staffing

# Checkout to a new branch
git checkout -b feat/my-new-feature

# Commit your changes
git commit -am "feat:Add some feature"

# Create a PR
gh pr create -w

Resources

Articles

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrProjectNotFound = errors.New("project not found")

Functions

This section is empty.

Types

type Department

type Department struct {
	ID        DepartmentID `json:"id"`
	Name      string       `json:"name"`
	Employees []Employee   `json:"employees"`
}

type DepartmentID

type DepartmentID string

type DepartmentRepository

type DepartmentRepository interface {
	CreateDepartment(ctx context.Context, name string) error
	AssignEmployee(ctx context.Context, departmentID DepartmentID, employeeID EmployeeID) error
	UnassignEmployee(ctx context.Context, departmentID DepartmentID, employeeID EmployeeID) error
	Close() error
}

type Employee

type Employee struct {
	ID   EmployeeID
	Name string
}

type EmployeeID

type EmployeeID string

type Project

type Project struct {
	ID   ProjectID
	Name string
}

type ProjectID

type ProjectID string

type ProjectRepository

type ProjectRepository interface {
	CreateProject(ctx context.Context, name string) error
	AssignEmployee(ctx context.Context, projectID ProjectID, employeeID EmployeeID) error
	UnassignEmployee(ctx context.Context, projectID ProjectID, employeeID EmployeeID) error
	Close() error
}

Directories

Path Synopsis
cmd
internal
proto
pb

Jump to

Keyboard shortcuts

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