-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
connect: support Tarantool tuple format
Support format for Tarantool tuples. This support only works for Tarantool versions >= 3.2. Closes #832 @TarantoolBot document Title: Support Tarantool tuple format This patch adds support for formatting Tarantool tuples. Installed Tarantool version must be >= 3.2. Otherwise, there will be no change. Examples: ``` > f = box.tuple.format.new({{'id', 'number'}, {'name', 'string'}}) --- ... > t = box.tuple.new({1, 'Flint', true}, {format = f}) --- ... > \xt > t +----+-------+------+ | id | name | col1 | +----+-------+------+ | 1 | Flint | true | +----+-------+------+ > box.space.customers:select() +----+-----------+-----+ | id | name | age | +----+-----------+-----+ | 1 | Elizabeth | 12 | +----+-----------+-----+ | 2 | Mary | 46 | +----+-----------+-----+ > \xT > t +------+-------+ | id | 1 | +------+-------+ | name | Flint | +------+-------+ | col1 | true | +------+-------+ > box.space.customers:select() +------+-----------+------+ | id | 1 | 2 | +------+-----------+------+ | name | Elizabeth | Mary | +------+-----------+------+ | age | 12 | 46 | +------+-----------+------+ ```
- Loading branch information
1 parent
1bf88c0
commit 8b94b74
Showing
11 changed files
with
965 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package formatter | ||
|
||
// lazyMessage is used for lazy Unmarshal. | ||
type lazyMessage struct { | ||
unmarshal func(any) error | ||
} | ||
|
||
// UnmarshalYAML makes lazyMessage an instance of yaml.Unmarshaler. | ||
func (msg *lazyMessage) UnmarshalYAML(unmarshal func(any) error) error { | ||
msg.unmarshal = unmarshal | ||
return nil | ||
} | ||
|
||
// Unmarshal the lazyMessage. | ||
func (msg *lazyMessage) Unmarshal(v any) error { | ||
if msg.unmarshal == nil { | ||
return nil | ||
} | ||
return msg.unmarshal(v) | ||
} |
Oops, something went wrong.