api

package
v0.0.0-...-88a9cf2 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Message string `json:"message"`
}

type NewNumberRequest

type NewNumberRequest struct {
	ID int `json:"id"`
}

type Number

type Number struct {
	ID        int    `json:"id"`
	Timestamp string `json:"timestamp"`
}

type NumberRepository

type NumberRepository interface {
	GetAll() ([]Number, error)
	Get(id int) (Number, error)
	Create(n NewNumberRequest) error
	Update(n Number, id int) error
	Remove(id int) error
}

Number repository is what lets our service do db operations without knowing anything about the implementation

type NumberService

type NumberService interface {
	New(user NewNumberRequest) error
	GetAll() ([]Number, error)
	Get(id int) (Number, error)
	Update(n Number, id int) error
	Remove(id int) error
}

NumberService contains the methods of the number service

func NewNumberService

func NewNumberService(numberRepo NumberRepository) NumberService

Jump to

Keyboard shortcuts

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