github.com/kyma-incubator/compass/components/director@v0.0.0-20230623144113-d764f56ff805/pkg/graphql/clob.go (about)

     1  package graphql
     2  
     3  import (
     4  	"io"
     5  	"strconv"
     6  
     7  	"github.com/kyma-incubator/compass/components/director/pkg/log"
     8  
     9  	"github.com/kyma-incubator/compass/components/director/pkg/scalar"
    10  )
    11  
    12  // CLOB missing godoc
    13  type CLOB string
    14  
    15  // UnmarshalGQL missing godoc
    16  func (y *CLOB) UnmarshalGQL(v interface{}) error {
    17  	val, err := scalar.ConvertToString(v)
    18  	if err != nil {
    19  		return err
    20  	}
    21  
    22  	*y = CLOB(val)
    23  
    24  	return nil
    25  }
    26  
    27  // MarshalGQL missing godoc
    28  func (y CLOB) MarshalGQL(w io.Writer) {
    29  	_, err := io.WriteString(w, strconv.Quote(string(y)))
    30  	if err != nil {
    31  		log.D().Errorf("while writing %T: %s", y, err)
    32  	}
    33  }