github.com/solo-io/cue@v0.4.7/pkg/uuid/pkg.go (about)

     1  // Code generated by go generate. DO NOT EDIT.
     2  
     3  //go:generate rm pkg.go
     4  //go:generate go run ../gen/gen.go
     5  
     6  package uuid
     7  
     8  import (
     9  	"github.com/solo-io/cue/internal/core/adt"
    10  	"github.com/solo-io/cue/pkg/internal"
    11  )
    12  
    13  func init() {
    14  	internal.Register("uuid", pkg)
    15  }
    16  
    17  var _ = adt.TopKind // in case the adt package isn't used
    18  
    19  var pkg = &internal.Package{
    20  	Native: []*internal.Builtin{{
    21  		Name: "Valid",
    22  		Params: []internal.Param{
    23  			{Kind: adt.StringKind},
    24  		},
    25  		Result: adt.BottomKind,
    26  		Func: func(c *internal.CallCtxt) {
    27  			s := c.String(0)
    28  			if c.Do() {
    29  				c.Ret = Valid(s)
    30  			}
    31  		},
    32  	}, {
    33  		Name: "Parse",
    34  		Params: []internal.Param{
    35  			{Kind: adt.StringKind},
    36  		},
    37  		Result: adt.StringKind,
    38  		Func: func(c *internal.CallCtxt) {
    39  			s := c.String(0)
    40  			if c.Do() {
    41  				c.Ret, c.Err = Parse(s)
    42  			}
    43  		},
    44  	}, {
    45  		Name: "ToString",
    46  		Params: []internal.Param{
    47  			{Kind: adt.StringKind},
    48  		},
    49  		Result: adt.StringKind,
    50  		Func: func(c *internal.CallCtxt) {
    51  			x := c.String(0)
    52  			if c.Do() {
    53  				c.Ret = ToString(x)
    54  			}
    55  		},
    56  	}, {
    57  		Name: "URN",
    58  		Params: []internal.Param{
    59  			{Kind: adt.StringKind},
    60  		},
    61  		Result: adt.StringKind,
    62  		Func: func(c *internal.CallCtxt) {
    63  			x := c.String(0)
    64  			if c.Do() {
    65  				c.Ret, c.Err = URN(x)
    66  			}
    67  		},
    68  	}, {
    69  		Name: "FromInt",
    70  		Params: []internal.Param{
    71  			{Kind: adt.IntKind},
    72  		},
    73  		Result: adt.StringKind,
    74  		Func: func(c *internal.CallCtxt) {
    75  			i := c.BigInt(0)
    76  			if c.Do() {
    77  				c.Ret, c.Err = FromInt(i)
    78  			}
    79  		},
    80  	}, {
    81  		Name: "ToInt",
    82  		Params: []internal.Param{
    83  			{Kind: adt.StringKind},
    84  		},
    85  		Result: adt.IntKind,
    86  		Func: func(c *internal.CallCtxt) {
    87  			x := c.String(0)
    88  			if c.Do() {
    89  				c.Ret = ToInt(x)
    90  			}
    91  		},
    92  	}, {
    93  		Name: "Variant",
    94  		Params: []internal.Param{
    95  			{Kind: adt.StringKind},
    96  		},
    97  		Result: adt.IntKind,
    98  		Func: func(c *internal.CallCtxt) {
    99  			x := c.String(0)
   100  			if c.Do() {
   101  				c.Ret, c.Err = Variant(x)
   102  			}
   103  		},
   104  	}, {
   105  		Name: "Version",
   106  		Params: []internal.Param{
   107  			{Kind: adt.StringKind},
   108  		},
   109  		Result: adt.IntKind,
   110  		Func: func(c *internal.CallCtxt) {
   111  			x := c.String(0)
   112  			if c.Do() {
   113  				c.Ret, c.Err = Version(x)
   114  			}
   115  		},
   116  	}, {
   117  		Name: "SHA1",
   118  		Params: []internal.Param{
   119  			{Kind: adt.StringKind},
   120  			{Kind: adt.BytesKind | adt.StringKind},
   121  		},
   122  		Result: adt.StringKind,
   123  		Func: func(c *internal.CallCtxt) {
   124  			space, data := c.String(0), c.Bytes(1)
   125  			if c.Do() {
   126  				c.Ret, c.Err = SHA1(space, data)
   127  			}
   128  		},
   129  	}, {
   130  		Name: "MD5",
   131  		Params: []internal.Param{
   132  			{Kind: adt.StringKind},
   133  			{Kind: adt.BytesKind | adt.StringKind},
   134  		},
   135  		Result: adt.StringKind,
   136  		Func: func(c *internal.CallCtxt) {
   137  			space, data := c.String(0), c.Bytes(1)
   138  			if c.Do() {
   139  				c.Ret, c.Err = MD5(space, data)
   140  			}
   141  		},
   142  	}},
   143  	CUE: `{
   144  	ns: {
   145  		DNS:  "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
   146  		URL:  "6ba7b811-9dad-11d1-80b4-00c04fd430c8"
   147  		OID:  "6ba7b812-9dad-11d1-80b4-00c04fd430c8"
   148  		X500: "6ba7b814-9dad-11d1-80b4-00c04fd430c8"
   149  		Nil:  "00000000-0000-0000-0000-000000000000"
   150  	}
   151  	variants: {
   152  		Invalid:   0
   153  		RFC4122:   1
   154  		Reserved:  2
   155  		Microsoft: 3
   156  		Future:    4
   157  	}
   158  }`,
   159  }