github.com/gogf/gf/v2@v2.7.4/util/gtag/gtag.go (about)

     1  // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
     2  //
     3  // This Source Code Form is subject to the terms of the MIT License.
     4  // If a copy of the MIT was not distributed with this file,
     5  // You can obtain one at https://github.com/gogf/gf.
     6  
     7  // Package gtag providing tag content storing for struct.
     8  //
     9  // Note that calling functions of this package is not concurrently safe,
    10  // which means you cannot call them in runtime but in boot procedure.
    11  package gtag
    12  
    13  const (
    14  	Default           = "default"      // Default value tag of struct field for receiving parameters from HTTP request.
    15  	DefaultShort      = "d"            // Short name of Default.
    16  	Param             = "param"        // Parameter name for converting certain parameter to specified struct field.
    17  	ParamShort        = "p"            // Short name of Param.
    18  	Valid             = "valid"        // Validation rule tag for struct of field.
    19  	ValidShort        = "v"            // Short name of Valid.
    20  	NoValidation      = "nv"           // No validation for specified struct/field.
    21  	ORM               = "orm"          // ORM tag for ORM feature, which performs different features according scenarios.
    22  	Arg               = "arg"          // Arg tag for struct, usually for command argument option.
    23  	Brief             = "brief"        // Brief tag for struct, usually be considered as summary.
    24  	Root              = "root"         // Root tag for struct, usually for nested commands management.
    25  	Additional        = "additional"   // Additional tag for struct, usually for additional description of command.
    26  	AdditionalShort   = "ad"           // Short name of Additional.
    27  	Path              = `path`         // Route path for HTTP request.
    28  	Method            = `method`       // Route method for HTTP request.
    29  	Domain            = `domain`       // Route domain for HTTP request.
    30  	Mime              = `mime`         // MIME type for HTTP request/response.
    31  	Consumes          = `consumes`     // MIME type for HTTP request.
    32  	Summary           = `summary`      // Summary for struct, usually for OpenAPI in request struct.
    33  	SummaryShort      = `sm`           // Short name of Summary.
    34  	SummaryShort2     = `sum`          // Short name of Summary.
    35  	Description       = `description`  // Description for struct, usually for OpenAPI in request struct.
    36  	DescriptionShort  = `dc`           // Short name of Description.
    37  	DescriptionShort2 = `des`          // Short name of Description.
    38  	Example           = `example`      // Example for struct, usually for OpenAPI in request struct.
    39  	ExampleShort      = `eg`           // Short name of Example.
    40  	Examples          = `examples`     // Examples for struct, usually for OpenAPI in request struct.
    41  	ExamplesShort     = `egs`          // Short name of Examples.
    42  	ExternalDocs      = `externalDocs` // External docs for struct, always for OpenAPI in request struct.
    43  	ExternalDocsShort = `ed`           // Short name of ExternalDocs.
    44  	GConv             = "gconv"        // GConv defines the converting target name for specified struct field.
    45  	GConvShort        = "c"            // GConv defines the converting target name for specified struct field.
    46  	Json              = "json"         // Json tag is supported by stdlib.
    47  	Security          = "security"     // Security defines scheme for authentication. Detail to see https://swagger.io/docs/specification/authentication/
    48  	In                = "in"           // Swagger distinguishes between the following parameter types based on the parameter location. Detail to see https://swagger.io/docs/specification/describing-parameters/
    49  	Required          = "required"     // OpenAPIv3 required attribute name for request body.
    50  )
    51  
    52  // StructTagPriority defines the default priority tags for Map*/Struct* functions.
    53  // Note that, the `gconv/param` tags are used by old version of package.
    54  // It is strongly recommended using short tag `c/p` instead in the future.
    55  var StructTagPriority = []string{
    56  	GConv, Param, GConvShort, ParamShort, Json,
    57  }