github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/encoding/gocode/testdata/pkg1/instance.cue (about)

     1  package pkg1
     2  
     3  import (
     4  	"math"
     5  	"strings"
     6  	"github.com/joomcode/cue/encoding/gocode/testdata/pkg2"
     7  )
     8  
     9  MyStruct: {
    10  	A:  <=10
    11  	B:  =~"cat" | *"dog"
    12  	O?: OtherStruct
    13  	I:  pkg2.ImportMe
    14  } @go(,complete=Complete)
    15  
    16  OtherStruct: {
    17  	A: strings.ContainsAny("X")
    18  	P: pkg2.PickMe
    19  }
    20  
    21  String: !="" @go(,validate=ValidateCUE)
    22  
    23  SpecialString: =~"special" @go(,type=string)
    24  
    25  IgnoreThis: =~"foo" // No corresponding Go type
    26  
    27  Omit: int @go(-)
    28  
    29  // NonExisting will be omitted as there is no equivalent Go type.
    30  NonExisting: {
    31  	B: string
    32  } @go(-)
    33  
    34  // ignore unexported unless explicitly enabled.
    35  foo: int
    36  
    37  Ptr: {
    38  	A: math.MultipleOf(10)
    39  }