Skip to content

Commit

Permalink
Extends Storer interface for all methods to also return an error
Browse files Browse the repository at this point in the history
In order to implement the Storer interface, all methods must now return
and error.

The value property in Puppy has had its type changed to an int to
represent a numerical cent figure so that it may be properly throw an
error if the value supplied is less than 0.

Lab 07 (anz-bank#589)
  • Loading branch information
patrickmarabeas committed Aug 19, 2019
1 parent bb43faf commit c52f22a
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions 07_errors/patrickmarabeas/types.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
package main

import (
"sync"
)
import "sync"

type Puppy struct {
ID int
Breed string
Color string
Value string
Value int // cents
}

type Storer interface {
Create(puppy Puppy) int
Read(ID int) Puppy
Update(ID int, puppy Puppy) bool
Destroy(ID int) bool
Create(puppy Puppy) (int, error)
Read(ID int) (Puppy, error)
Update(ID int, puppy Puppy) (bool, error)
Destroy(ID int) (bool, error)
}

type MapStore struct {
Expand Down

0 comments on commit c52f22a

Please sign in to comment.