github.com/pouriasharifi/gqlgen@v0.7.2/codegen/testserver/interfaces.go (about)

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