github.com/cloudwego/dynamicgo@v0.2.6-0.20240519101509-707f41b6b834/conv/README.md (about) 1 <!-- Code generated by gomarkdoc. DO NOT EDIT --> 2 3 # conv 4 5 ```go 6 import "github.com/cloudwego/dynamicgo/conv" 7 ``` 8 9 ## Index 10 11 - [Variables](<#variables>) 12 - [func FreeBytes(b *[]byte)](<#func-freebytes>) 13 - [func NewBytes() *[]byte](<#func-newbytes>) 14 - [type ContextKey](<#type-contextkey>) 15 - [type Options](<#type-options>) 16 17 18 ## Variables 19 20 ```go 21 var ( 22 // CtxKeyHTTPResponse is the key for http.ResponseSetter in context 23 CtxKeyHTTPResponse = &ContextKey{} 24 // CtxKeyHTTPRequest is the key for http.RequestGetter in context 25 CtxKeyHTTPRequest = &ContextKey{} 26 // CtxKeyThriftRespBase is the key for base.Base in context 27 CtxKeyThriftRespBase = &ContextKey{} 28 // CtxKeyThriftReqBase is the key for base.BaseResp in context 29 CtxKeyThriftReqBase = &ContextKey{} 30 // CtxKeyConvOptions is the key for Options in context 31 CtxKeyConvOptions = &ContextKey{} 32 ) 33 ``` 34 35 ```go 36 var ( 37 // DefaultBufferSize is the default buffer size for conversion 38 DefaultBufferSize = 4096 39 // DefaultHttpValueBufferSize is the default buffer size for copying a json value 40 DefaulHttpValueBufferSizeForJSON = 1024 41 // DefaultHttpValueBufferSize is the default buffer size for copying a http value 42 DefaulHttpValueBufferSizeForScalar = 64 43 ) 44 ``` 45 46 ## func FreeBytes 47 48 ```go 49 func FreeBytes(b *[]byte) 50 ``` 51 52 FreeBytes returns a byte slice to pool and reset it 53 54 ## func NewBytes 55 56 ```go 57 func NewBytes() *[]byte 58 ``` 59 60 NewBytes returns a new byte slice from pool 61 62 ## type ContextKey 63 64 ContextKey is the key type for context arguments 65 66 ```go 67 type ContextKey struct { 68 // contains filtered or unexported fields 69 } 70 ``` 71 72 ## type Options 73 74 ```go 75 type Options struct { 76 // DisallowUnknownField indicates if unknown fields should be skipped 77 DisallowUnknownField bool 78 // WriteDefaultField indicates if default-requireness fields should be written if 79 WriteDefaultField bool 80 // EnableValueMapping indicates if value mapping (api.js_conv...) should be enabled 81 EnableValueMapping bool 82 // EnableHttpMapping indicates if http mapping (api.query|api.header...) should be enabled 83 EnableHttpMapping bool 84 // HttpMappingAsExtra indicates if continuing convert the same field after http mapping 85 HttpMappingAsExtra bool 86 // EnableThriftBase indicates if thrift/base should be recoginized and mapping to/from context 87 EnableThriftBase bool 88 // UseNativeSkip indicates if use thrift.SkipNative() or thrift.SkipGo() 89 UseNativeSkip bool 90 // Int64AsString indicates if string value cane be read as **Int8/Int16/Int32/Int64/Float64**, 91 // or in response a **Int64** value can be written as string 92 String2Int64 bool 93 // WriteRequireField indicates if required-requireness fields should be written empty value if 94 // not found 95 WriteRequireField bool 96 // NoBase64Binary indicates if base64 string shoud be Encode/Decode as []byte 97 NoBase64Binary bool 98 // ByteAsUint8 indicates if byte should be conv as uint8 (default is int8), this only works for t2j now 99 ByteAsUint8 bool 100 // WriteOptionalField indicates if optional-requireness fields should be written when not given 101 WriteOptionalField bool 102 // TracebackRequredOrRootFields indicates if required-requireness 103 // or root-level fields should be seeking on http-values when reading failed from current layer of json. 104 // this option is only used in j2t now. 105 TracebackRequredOrRootFields bool 106 // NoCopyString indicates if string should be copied or just referenced (if possible) 107 NoCopyString bool 108 } 109 ``` 110 111 112 113 Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)