service

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 3 Imported by: 0

README

  • Service is your main business logic
  • You should always call your repository methods in this package
  • You may use your src/library functions directly in this package
  • Any changes outside this package should not affect your services (except changes for business entity or repository)
  • If you need config variables, external clients, or repositories, pass/inject them as dependency
  • You can use your own style as long as it doesn't break the main idea

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Example string `json:"example"`
}

type Example added in v2.1.0

type Example interface {
	// GetAll gets all example data.
	GetAll(param ExampleGetAllParam) ExampleGetAllResult
}

func NewExample added in v2.1.0

func NewExample(param NewExampleParam) Example

NewExample generates new example that implements Example.

type ExampleGetAllParam added in v2.1.0

type ExampleGetAllParam struct {
	Ctx context.Context // In case you need a context.
}

type ExampleGetAllResult added in v2.1.0

type ExampleGetAllResult struct {
	Examples []*entity.Example `json:"examples"`
	Error    error             `json:"error"`
}

type NewExampleParam added in v2.1.0

type NewExampleParam struct {
	ExampleRepo repository.Example
}

type NewParam

type NewParam struct {
	Repo   *repository.Repository
	Config *Config
}

type Service

type Service struct {
	Example Example
}

func New

func New(param NewParam) *Service

New generates new service.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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