You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#### 3. Init clients and servers with `WithPayloadCodec(thrift.NewThriftFrugalCodec())` option
81
+
Note: Latest thriftgo (>= v0.3.0) generates `thrift` struct tags that are compatible with Frugal by default, so `frugal_tag` is optional for structs without `list`, `set` or `enum` fields.
82
+
83
+
#### 3. Init clients and servers with Frugal codec
84
+
85
+
Use `thrift.NewThriftCodecWithConfig` to enable Frugal. Codec type priority: Frugal > FastCodec > Apache Thrift.
Note: Kitex automatically falls back to FastCodec or Apache Thrift for types that don't have `frugal` struct tags, so it's safe to enable Frugal globally.
132
+
133
+
#### Codec type options
134
+
135
+
| Option | Description |
136
+
|--------|-------------|
137
+
|`thrift.FrugalRead`| Use Frugal for deserialization |
138
+
|`thrift.FrugalWrite`| Use Frugal for serialization |
139
+
|`thrift.FrugalReadWrite`| Shorthand for `FrugalRead \| FrugalWrite`|
140
+
|`thrift.FastRead`| Use FastCodec for deserialization |
141
+
|`thrift.FastWrite`| Use FastCodec for serialization |
142
+
|`thrift.EnableSkipDecoder`| Required when using Buffered transport (no Framed/TTHeader) |
143
+
144
+
For Framed or TTHeader transport, `FrugalRead | FrugalWrite` is sufficient. For Buffered (PurePayload) transport, add `EnableSkipDecoder`:
Now we have thrift file, we can use Thriftgo with `frugal_tag` option to generate Go code.
167
+
Now we have thrift file, we can use Thriftgo to generate Go code.
144
168
145
-
Example:
169
+
Latest thriftgo (>= v0.3.0) generates `thrift` struct tags that are compatible with Frugal by default. For structs containing `list`, `set` or `enum` fields, add `frugal_tag` to generate explicit Frugal tags:
0 commit comments