Skip to content

Commit

Permalink
add Gateways struct and implement stringer
Browse files Browse the repository at this point in the history
  • Loading branch information
secret2830 committed Jun 6, 2019
1 parent c5f8261 commit fb7d502
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/v1/asset/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ type Gateway struct {
Website string `json:"website"` // the external website of the gateway
}

// String implements fmt.Stringer
func (g Gateway) String() string {
return fmt.Sprintf("Gateway{%s, %s, %s, %s, %s}", g.Owner, g.Moniker, g.Identity, g.Details, g.Website)
}

// Gateways is a set of gateways
type Gateways []Gateway

// String implements fmt.Stringer
func (gs Gateways) String() string {
str := fmt.Sprintf("Gateways for owner %s:", gs[0].Owner)
for _, g := range gs {
str += fmt.Sprintf("\n %s: %s: %s : %s", g.Moniker, g.Identity, g.Details, g.Website)
}
return str
}

0 comments on commit fb7d502

Please sign in to comment.