github.com/diadata-org/diadata@v1.4.593/pkg/graphql/resolver/chartresolver.go (about)

     1  package resolver
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/diadata-org/diadata/pkg/dia"
     7  	"github.com/graph-gophers/graphql-go"
     8  )
     9  
    10  type FilterPointResolver struct {
    11  	q dia.FilterPoint
    12  }
    13  type TradeResolver struct {
    14  	q dia.Trade
    15  }
    16  
    17  func (qr *FilterPointResolver) Name(ctx context.Context) (*string, error) {
    18  	return &qr.q.Name, nil
    19  }
    20  
    21  func (qr *FilterPointResolver) Symbol(ctx context.Context) (*string, error) {
    22  	return &qr.q.Asset.Symbol, nil
    23  }
    24  
    25  func (qr *FilterPointResolver) Time(ctx context.Context) (*graphql.Time, error) {
    26  	return &graphql.Time{Time: qr.q.Time}, nil
    27  }
    28  
    29  func (qr *FilterPointResolver) Value(ctx context.Context) (*float64, error) {
    30  	return &qr.q.Value, nil
    31  }
    32  func (qr *FilterPointResolver) Address(ctx context.Context) (*string, error) {
    33  	return &qr.q.Asset.Address, nil
    34  }
    35  
    36  func (qr *FilterPointResolver) Blockchain(ctx context.Context) (*string, error) {
    37  	return &qr.q.Asset.Blockchain, nil
    38  }
    39  
    40  func (qr *FilterPointResolver) FirstTrade(ctx context.Context) (*TradeResolver, error) {
    41  	return &TradeResolver{q: qr.q.FirstTrade}, nil
    42  }
    43  func (qr *FilterPointResolver) LastTrade(ctx context.Context) (*TradeResolver, error) {
    44  	return &TradeResolver{q: qr.q.LastTrade}, nil
    45  }
    46  
    47  func (qr *TradeResolver) Price(ctx context.Context) (*float64, error) {
    48  	return &qr.q.Price, nil
    49  }
    50  func (qr *TradeResolver) Pair(ctx context.Context) (*string, error) {
    51  	return &qr.q.Pair, nil
    52  }
    53  
    54  func (qr *TradeResolver) Volume(ctx context.Context) (*float64, error) {
    55  	return &qr.q.Volume, nil
    56  }
    57  func (qr *TradeResolver) Symbol(ctx context.Context) (*string, error) {
    58  	return &qr.q.Symbol, nil
    59  }
    60  
    61  func (qr *TradeResolver) EstimatedUSDPrice(ctx context.Context) (*float64, error) {
    62  	return &qr.q.EstimatedUSDPrice, nil
    63  }