github.com/aacfactory/fns@v1.2.86-0.20240310083819-80d667fc0a17/cmd/generates/sources/builtins.go (about)

     1  /*
     2   * Copyright 2023 Wang Min Xiang
     3   *
     4   * Licensed under the Apache License, Version 2.0 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   *
     8   * 	http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   *
    16   */
    17  
    18  package sources
    19  
    20  func registerBuiltinTypes(mode *Module) {
    21  	// github.com/aacfactory/fns/commons/passwords.password
    22  	mode.RegisterBuiltinType(&Type{
    23  		Kind:        BasicKind,
    24  		Path:        "github.com/aacfactory/fns/commons/passwords",
    25  		Name:        "Password",
    26  		Annotations: nil,
    27  		Paradigms:   nil,
    28  		Tags:        nil,
    29  		Elements:    nil,
    30  	})
    31  	// time.Time
    32  	mode.RegisterBuiltinType(&Type{
    33  		Kind:        BasicKind,
    34  		Path:        "time",
    35  		Name:        "Time",
    36  		Annotations: nil,
    37  		Paradigms:   nil,
    38  		Tags:        nil,
    39  		Elements:    nil,
    40  	})
    41  	// time.Duration
    42  	mode.RegisterBuiltinType(&Type{
    43  		Kind:        BasicKind,
    44  		Path:        "time",
    45  		Name:        "Duration",
    46  		Annotations: nil,
    47  		Paradigms:   nil,
    48  		Tags:        nil,
    49  		Elements:    nil,
    50  	})
    51  	// encoding/json.RawMessage
    52  	mode.RegisterBuiltinType(&Type{
    53  		Kind:        BasicKind,
    54  		Path:        "encoding/json",
    55  		Name:        "RawMessage",
    56  		Annotations: nil,
    57  		Paradigms:   nil,
    58  		Tags:        nil,
    59  		Elements:    nil,
    60  	})
    61  	// github.com/aacfactory/json.RawMessage
    62  	mode.RegisterBuiltinType(&Type{
    63  		Kind:        BasicKind,
    64  		Path:        "github.com/aacfactory/json",
    65  		Name:        "RawMessage",
    66  		Annotations: nil,
    67  		Paradigms:   nil,
    68  		Tags:        nil,
    69  		Elements:    nil,
    70  	})
    71  	// github.com/aacfactory/json.Date
    72  	mode.RegisterBuiltinType(&Type{
    73  		Kind:        BasicKind,
    74  		Path:        "github.com/aacfactory/json",
    75  		Name:        "Date",
    76  		Annotations: nil,
    77  		Paradigms:   nil,
    78  		Tags:        nil,
    79  		Elements:    nil,
    80  	})
    81  	// github.com/aacfactory/json.Time
    82  	mode.RegisterBuiltinType(&Type{
    83  		Kind:        BasicKind,
    84  		Path:        "github.com/aacfactory/json",
    85  		Name:        "Time",
    86  		Annotations: nil,
    87  		Paradigms:   nil,
    88  		Tags:        nil,
    89  		Elements:    nil,
    90  	})
    91  	// github.com/aacfactory/json.Object
    92  	mode.RegisterBuiltinType(&Type{
    93  		Kind:        AnyKind,
    94  		Path:        "github.com/aacfactory/json",
    95  		Name:        "Object",
    96  		Annotations: nil,
    97  		Paradigms:   nil,
    98  		Tags:        nil,
    99  		Elements:    nil,
   100  	})
   101  	// github.com/aacfactory/json.Array
   102  	mode.RegisterBuiltinType(&Type{
   103  		Kind:        ArrayKind,
   104  		Path:        "github.com/aacfactory/json",
   105  		Name:        "Array",
   106  		Annotations: nil,
   107  		Paradigms:   nil,
   108  		Tags:        nil,
   109  		Elements:    []*Type{AnyType},
   110  	})
   111  	// github.com/aacfactory/services.Empty
   112  	mode.RegisterBuiltinType(&Type{
   113  		Kind:        BuiltinKind,
   114  		Path:        "github.com/aacfactory/services",
   115  		Name:        "Empty",
   116  		Annotations: nil,
   117  		Paradigms:   nil,
   118  		Tags:        nil,
   119  		Elements:    nil,
   120  	})
   121  	// github.com/aacfactory/errors.CodeErr
   122  	mode.RegisterBuiltinType(&Type{
   123  		Kind: StructKind,
   124  		Path: "github.com/aacfactory/errors",
   125  		Name: "CodeError",
   126  		Annotations: Annotations{
   127  			NewAnnotation("title", "Code error"),
   128  			NewAnnotation("description", "Errors with code and tracking"),
   129  		},
   130  		Paradigms: nil,
   131  		Tags:      nil,
   132  		Elements: []*Type{
   133  			{
   134  				Kind: StructFieldKind,
   135  				Name: "Id",
   136  				Tags: map[string]string{"json": "id"},
   137  				Elements: []*Type{{
   138  					Kind: BasicKind,
   139  					Name: "string",
   140  				}},
   141  			},
   142  			{
   143  				Kind: StructFieldKind,
   144  				Name: "Code",
   145  				Tags: map[string]string{"json": "code"},
   146  				Elements: []*Type{{
   147  					Kind: BasicKind,
   148  					Name: "int",
   149  				}},
   150  			},
   151  			{
   152  				Kind: StructFieldKind,
   153  				Name: "Name",
   154  				Tags: map[string]string{"json": "name"},
   155  				Elements: []*Type{{
   156  					Kind: BasicKind,
   157  					Name: "string",
   158  				}},
   159  			},
   160  			{
   161  				Kind: StructFieldKind,
   162  				Name: "Message",
   163  				Tags: map[string]string{"json": "message"},
   164  				Elements: []*Type{{
   165  					Kind: BasicKind,
   166  					Name: "string",
   167  				}},
   168  			},
   169  			{
   170  				Kind: StructFieldKind,
   171  				Name: "Meta",
   172  				Tags: map[string]string{"json": "meta"},
   173  				Elements: []*Type{{
   174  					Kind:        MapKind,
   175  					Path:        "",
   176  					Name:        "",
   177  					Annotations: nil,
   178  					Paradigms:   nil,
   179  					Tags:        nil,
   180  					Elements: []*Type{
   181  						{
   182  							Kind: BasicKind,
   183  							Name: "string",
   184  						},
   185  						{
   186  							Kind: BasicKind,
   187  							Name: "string",
   188  						},
   189  					},
   190  				}},
   191  			},
   192  			{
   193  				Kind: StructFieldKind,
   194  				Name: "Stacktrace",
   195  				Tags: map[string]string{"json": "stacktrace"},
   196  				Elements: []*Type{
   197  					{
   198  						Kind: StructKind,
   199  						Path: "github.com/aacfactory/errors",
   200  						Name: "Stacktrace",
   201  						Elements: []*Type{
   202  							{
   203  								Kind: StructFieldKind,
   204  								Name: "Fn",
   205  								Tags: map[string]string{"json": "fn"},
   206  								Elements: []*Type{{
   207  									Kind: BasicKind,
   208  									Name: "string",
   209  								}},
   210  							},
   211  							{
   212  								Kind: StructFieldKind,
   213  								Name: "File",
   214  								Tags: map[string]string{"json": "file"},
   215  								Elements: []*Type{{
   216  									Kind: BasicKind,
   217  									Name: "string",
   218  								}},
   219  							},
   220  							{
   221  								Kind: StructFieldKind,
   222  								Name: "Line",
   223  								Tags: map[string]string{"json": "line"},
   224  								Elements: []*Type{{
   225  									Kind: BasicKind,
   226  									Name: "int",
   227  								}},
   228  							},
   229  						},
   230  					},
   231  				},
   232  			},
   233  			{
   234  				Kind: StructFieldKind,
   235  				Name: "Cause",
   236  				Tags: map[string]string{"json": "cause"},
   237  				Elements: []*Type{{
   238  					Kind: ReferenceKind,
   239  					Path: "github.com/aacfactory/errors",
   240  					Name: "CodeError",
   241  				}},
   242  			},
   243  		},
   244  	})
   245  	// github.com/aacfactory/fns/commons/times.Date
   246  	mode.RegisterBuiltinType(&Type{
   247  		Kind:        BasicKind,
   248  		Path:        "github.com/aacfactory/fns/commons/times",
   249  		Name:        "Date",
   250  		Annotations: nil,
   251  		Paradigms:   nil,
   252  		Tags:        nil,
   253  		Elements:    nil,
   254  	})
   255  	// github.com/aacfactory/fns/commons/times.Time
   256  	mode.RegisterBuiltinType(&Type{
   257  		Kind:        BasicKind,
   258  		Path:        "github.com/aacfactory/fns/commons/times",
   259  		Name:        "Time",
   260  		Annotations: nil,
   261  		Paradigms:   nil,
   262  		Tags:        nil,
   263  		Elements:    nil,
   264  	})
   265  }