plant

package
v0.0.0-...-f597de0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DbRepository

type DbRepository struct {
	Db *sql.DB
}

DbRepository is a Repository to operate a User encapsulating a Database connection.

func (*DbRepository) CreatePlant

func (r *DbRepository) CreatePlant(p *Plant) (int64, error)

CreatePlant creates a Plant.

func (*DbRepository) FindPlantByID

func (r *DbRepository) FindPlantByID(plantID string) (*Plant, error)

FindPlantByID finds a Plant from its ID.

type Plant

type Plant struct {
	ID          int64
	Name        string
	PlantedDate time.Time
	Price       float64
	Reserved    bool
}

Plant model struct

type Repository

type Repository interface {
	CreatePlant(p *Plant) (int64, error)
	FindPlantByID(plantID string) (*Plant, error)
}

Repository interface for operating a Plant

type Service

type Service struct {
	PlantRepository Repository
}

Service is the plant Service.

func (Service) CreatePlant

func (s Service) CreatePlant(p *Plant) (int64, error)

CreatePlant creates a new Plant It returns Plant ID.

func (Service) GetPlant

func (s Service) GetPlant(plantID string) (*Plant, error)

GetPlant gets the Plant information from its ID

Jump to

Keyboard shortcuts

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