github.com/tobiash/gqlgen@v0.5.1/codegen/testserver/interfaces.go (about)

     1  package testserver
     2  
     3  import "math"
     4  
     5  type Shape interface {
     6  	Area() float64
     7  }
     8  
     9  type ShapeUnion interface {
    10  	Area() float64
    11  }
    12  
    13  type Circle struct {
    14  	Radius float64
    15  }
    16  
    17  func (c *Circle) Area() float64 {
    18  	return c.Radius * math.Pi * math.Pi
    19  }
    20  
    21  type Rectangle struct {
    22  	Length, Width float64
    23  }
    24  
    25  func (r *Rectangle) Area() float64 {
    26  	return r.Length * r.Width
    27  }