github.com/solo-io/cue@v0.4.7/pkg/time/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 time
     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("time", 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:  "Nanosecond",
    22  		Const: "1",
    23  	}, {
    24  		Name:  "Microsecond",
    25  		Const: "1000",
    26  	}, {
    27  		Name:  "Millisecond",
    28  		Const: "1000000",
    29  	}, {
    30  		Name:  "Second",
    31  		Const: "1000000000",
    32  	}, {
    33  		Name:  "Minute",
    34  		Const: "60000000000",
    35  	}, {
    36  		Name:  "Hour",
    37  		Const: "3600000000000",
    38  	}, {
    39  		Name: "Duration",
    40  		Params: []internal.Param{
    41  			{Kind: adt.StringKind},
    42  		},
    43  		Result: adt.BoolKind,
    44  		Func: func(c *internal.CallCtxt) {
    45  			s := c.String(0)
    46  			if c.Do() {
    47  				c.Ret, c.Err = Duration(s)
    48  			}
    49  		},
    50  	}, {
    51  		Name: "ParseDuration",
    52  		Params: []internal.Param{
    53  			{Kind: adt.StringKind},
    54  		},
    55  		Result: adt.IntKind,
    56  		Func: func(c *internal.CallCtxt) {
    57  			s := c.String(0)
    58  			if c.Do() {
    59  				c.Ret, c.Err = ParseDuration(s)
    60  			}
    61  		},
    62  	}, {
    63  		Name:  "ANSIC",
    64  		Const: "\"Mon Jan _2 15:04:05 2006\"",
    65  	}, {
    66  		Name:  "UnixDate",
    67  		Const: "\"Mon Jan _2 15:04:05 MST 2006\"",
    68  	}, {
    69  		Name:  "RubyDate",
    70  		Const: "\"Mon Jan 02 15:04:05 -0700 2006\"",
    71  	}, {
    72  		Name:  "RFC822",
    73  		Const: "\"02 Jan 06 15:04 MST\"",
    74  	}, {
    75  		Name:  "RFC822Z",
    76  		Const: "\"02 Jan 06 15:04 -0700\"",
    77  	}, {
    78  		Name:  "RFC850",
    79  		Const: "\"Monday, 02-Jan-06 15:04:05 MST\"",
    80  	}, {
    81  		Name:  "RFC1123",
    82  		Const: "\"Mon, 02 Jan 2006 15:04:05 MST\"",
    83  	}, {
    84  		Name:  "RFC1123Z",
    85  		Const: "\"Mon, 02 Jan 2006 15:04:05 -0700\"",
    86  	}, {
    87  		Name:  "RFC3339",
    88  		Const: "\"2006-01-02T15:04:05Z07:00\"",
    89  	}, {
    90  		Name:  "RFC3339Nano",
    91  		Const: "\"2006-01-02T15:04:05.999999999Z07:00\"",
    92  	}, {
    93  		Name:  "RFC3339Date",
    94  		Const: "\"2006-01-02\"",
    95  	}, {
    96  		Name:  "Kitchen",
    97  		Const: "\"3:04PM\"",
    98  	}, {
    99  		Name:  "Kitchen24",
   100  		Const: "\"15:04\"",
   101  	}, {
   102  		Name:  "January",
   103  		Const: "1",
   104  	}, {
   105  		Name:  "February",
   106  		Const: "2",
   107  	}, {
   108  		Name:  "March",
   109  		Const: "3",
   110  	}, {
   111  		Name:  "April",
   112  		Const: "4",
   113  	}, {
   114  		Name:  "May",
   115  		Const: "5",
   116  	}, {
   117  		Name:  "June",
   118  		Const: "6",
   119  	}, {
   120  		Name:  "July",
   121  		Const: "7",
   122  	}, {
   123  		Name:  "August",
   124  		Const: "8",
   125  	}, {
   126  		Name:  "September",
   127  		Const: "9",
   128  	}, {
   129  		Name:  "October",
   130  		Const: "10",
   131  	}, {
   132  		Name:  "November",
   133  		Const: "11",
   134  	}, {
   135  		Name:  "December",
   136  		Const: "12",
   137  	}, {
   138  		Name:  "Sunday",
   139  		Const: "0",
   140  	}, {
   141  		Name:  "Monday",
   142  		Const: "1",
   143  	}, {
   144  		Name:  "Tuesday",
   145  		Const: "2",
   146  	}, {
   147  		Name:  "Wednesday",
   148  		Const: "3",
   149  	}, {
   150  		Name:  "Thursday",
   151  		Const: "4",
   152  	}, {
   153  		Name:  "Friday",
   154  		Const: "5",
   155  	}, {
   156  		Name:  "Saturday",
   157  		Const: "6",
   158  	}, {
   159  		Name: "Time",
   160  		Params: []internal.Param{
   161  			{Kind: adt.StringKind},
   162  		},
   163  		Result: adt.BoolKind,
   164  		Func: func(c *internal.CallCtxt) {
   165  			s := c.String(0)
   166  			if c.Do() {
   167  				c.Ret, c.Err = Time(s)
   168  			}
   169  		},
   170  	}, {
   171  		Name: "Format",
   172  		Params: []internal.Param{
   173  			{Kind: adt.StringKind},
   174  			{Kind: adt.StringKind},
   175  		},
   176  		Result: adt.BoolKind,
   177  		Func: func(c *internal.CallCtxt) {
   178  			value, layout := c.String(0), c.String(1)
   179  			if c.Do() {
   180  				c.Ret, c.Err = Format(value, layout)
   181  			}
   182  		},
   183  	}, {
   184  		Name: "Parse",
   185  		Params: []internal.Param{
   186  			{Kind: adt.StringKind},
   187  			{Kind: adt.StringKind},
   188  		},
   189  		Result: adt.StringKind,
   190  		Func: func(c *internal.CallCtxt) {
   191  			layout, value := c.String(0), c.String(1)
   192  			if c.Do() {
   193  				c.Ret, c.Err = Parse(layout, value)
   194  			}
   195  		},
   196  	}, {
   197  		Name: "Unix",
   198  		Params: []internal.Param{
   199  			{Kind: adt.IntKind},
   200  			{Kind: adt.IntKind},
   201  		},
   202  		Result: adt.StringKind,
   203  		Func: func(c *internal.CallCtxt) {
   204  			sec, nsec := c.Int64(0), c.Int64(1)
   205  			if c.Do() {
   206  				c.Ret = Unix(sec, nsec)
   207  			}
   208  		},
   209  	}},
   210  }