Skip to content

Instantly share code, notes, and snippets.

package news
import "store"
type Totaller interface {
Subtotal() float64
}
type NewsfeedRenderable struct {}
@cep21
cep21 / store2.go
Last active November 2, 2016 18:11
package store
type Totaller interface {
Subtotal() float64
}
type Store struct {
}
func (s *Store) RenderPage(t Totaller) {
@cep21
cep21 / store.go
Last active November 2, 2016 18:04
package store
import "cart"
type Store struct {
}
func (s *Store) RenderPage(c *cart.Cart) {
// Do thing with total
}
@cep21
cep21 / cart.go
Last active November 2, 2016 18:03
package cart
type Cart struct {
}
func (c *Cart) Subtotal() float64 {
// calculate and return
}
package customer
import "item"
type User struct {
Name string
}
type Item => item.Item
@cep21
cep21 / client2.go
Last active October 26, 2016 18:42
package cart
import "customer"
import "item"
type Client struct {
}
func (c *Client) Purchase(who *customer.User, what *item.Item) {
}
package item
type Item struct {
Price float64
}
package customer
type User struct {
Name string
}
@cep21
cep21 / client.go
Last active November 1, 2016 18:58
package cart
import "customer"
type Client struct {
}
func (c *Client) Purchase(who *customer.User, what *customer.Item) {
}
@cep21
cep21 / customer.go
Last active October 26, 2016 17:59
package customer
type User struct {
Name string
}
type Item struct {
Price float64
}