Documentation
¶
Index ¶
- Variables
- func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
- type Article
- type ArticleInput
- type ComplexityRoot
- type Config
- type DirectiveRoot
- type EntityRepresentation
- type EntityResolver
- type EntityWithIndex
- type Mutation
- type MutationResolver
- type Order
- type OrderArticle
- type OrderStatus
- type OrderSummary
- type PaymentEvent
- type PaymentEventInput
- type PaymentMethod
- type Query
- type QueryResolver
- type ResolverRoot
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnknownType = errors.New("unknown type") ErrTypeNotFound = errors.New("type not found") )
View Source
var AllOrderStatus = []OrderStatus{ OrderStatusPlaced, OrderStatusInvalid, OrderStatusValidated, OrderStatusPaymentDefined, }
View Source
var AllPaymentMethod = []PaymentMethod{ PaymentMethodCash, PaymentMethodCredit, PaymentMethodDebit, }
Functions ¶
func NewExecutableSchema ¶
func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.
Types ¶
type ArticleInput ¶
type ComplexityRoot ¶
type ComplexityRoot struct {
Article struct {
ID func(childComplexity int) int
}
Entity struct {
FindOrderByID func(childComplexity int, id string) int
}
Mutation struct {
CreatePayment func(childComplexity int, orderID string, payment *PaymentEventInput) int
}
Order struct {
Articles func(childComplexity int) int
CartID func(childComplexity int) int
ID func(childComplexity int) int
OrderID func(childComplexity int) int
Payments func(childComplexity int) int
Status func(childComplexity int) int
UserID func(childComplexity int) int
}
OrderArticle struct {
Article func(childComplexity int) int
ArticleID func(childComplexity int) int
IsValid func(childComplexity int) int
IsValidated func(childComplexity int) int
Quantity func(childComplexity int) int
UnitaryPrice func(childComplexity int) int
}
OrderSummary struct {
Articles func(childComplexity int) int
CartID func(childComplexity int) int
ID func(childComplexity int) int
Status func(childComplexity int) int
TotalPayment func(childComplexity int) int
TotalPrice func(childComplexity int) int
}
PaymentEvent struct {
Amount func(childComplexity int) int
Method func(childComplexity int) int
}
Query struct {
GetOrder func(childComplexity int, id string) int
GetOrders func(childComplexity int) int
// contains filtered or unexported fields
}
// contains filtered or unexported fields
}
type Config ¶
type Config struct {
Schema *ast.Schema
Resolvers ResolverRoot
Directives DirectiveRoot
Complexity ComplexityRoot
}
type DirectiveRoot ¶
type DirectiveRoot struct {
}
type EntityRepresentation ¶
EntityRepresentation is the JSON representation of an entity sent by the Router used as the inputs for us to resolve.
We make it a map because we know the top level JSON is always an object.
type EntityResolver ¶
type EntityWithIndex ¶
type EntityWithIndex struct {
// contains filtered or unexported fields
}
type MutationResolver ¶
type Order ¶
type Order struct {
ID string `json:"id"`
OrderID string `json:"orderId"`
Status OrderStatus `json:"status"`
UserID string `json:"userId"`
CartID string `json:"cartId"`
Articles []*OrderArticle `json:"articles,omitempty"`
Payments []*PaymentEvent `json:"payments,omitempty"`
}
type OrderArticle ¶
type OrderStatus ¶
type OrderStatus string
const ( OrderStatusPlaced OrderStatus = "PLACED" OrderStatusInvalid OrderStatus = "INVALID" OrderStatusValidated OrderStatus = "VALIDATED" OrderStatusPaymentDefined OrderStatus = "PAYMENT_DEFINED" )
func (OrderStatus) IsValid ¶
func (e OrderStatus) IsValid() bool
func (OrderStatus) MarshalGQL ¶
func (e OrderStatus) MarshalGQL(w io.Writer)
func (OrderStatus) String ¶
func (e OrderStatus) String() string
func (*OrderStatus) UnmarshalGQL ¶
func (e *OrderStatus) UnmarshalGQL(v interface{}) error
type OrderSummary ¶
type PaymentEvent ¶
type PaymentEvent struct {
Method PaymentMethod `json:"method"`
Amount float64 `json:"amount"`
}
type PaymentEventInput ¶
type PaymentEventInput struct {
Method PaymentMethod `json:"method"`
Amount float64 `json:"amount"`
}
type PaymentMethod ¶
type PaymentMethod string
const ( PaymentMethodCash PaymentMethod = "CASH" PaymentMethodCredit PaymentMethod = "CREDIT" PaymentMethodDebit PaymentMethod = "DEBIT" )
func (PaymentMethod) IsValid ¶
func (e PaymentMethod) IsValid() bool
func (PaymentMethod) MarshalGQL ¶
func (e PaymentMethod) MarshalGQL(w io.Writer)
func (PaymentMethod) String ¶
func (e PaymentMethod) String() string
func (*PaymentMethod) UnmarshalGQL ¶
func (e *PaymentMethod) UnmarshalGQL(v interface{}) error
type QueryResolver ¶
type ResolverRoot ¶
type ResolverRoot interface {
Entity() EntityResolver
Mutation() MutationResolver
Query() QueryResolver
}
Click to show internal directories.
Click to hide internal directories.