-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tupleconv: initial logic #2
Conversation
5136736
to
d914e0e
Compare
Can you please add some usage examples to the description of this PR? |
Allowed comments are |
eee12c2
to
6c6b25a
Compare
Sure, added. |
53c4951
to
d2105f6
Compare
Pls, add description and examples to readme. |
ff50cbc
to
d15c01a
Compare
5c1090d
to
9056f9e
Compare
a32e548
to
66d1450
Compare
example_test.go
Outdated
if err != nil { | ||
fmt.Println(err) | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It clean ups data folders etc.
if err != nil { | |
fmt.Println(err) | |
return nil | |
} | |
if err != nil { | |
test_helpers.StopTarantoolWithCleanup(inst) | |
fmt.Println(err) | |
return nil | |
} |
example_test.go
Outdated
const workDir = "work_dir" | ||
const server = "127.0.0.1:3014" | ||
|
||
func upTarantool() func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func upTarantool() func() { | |
func upTarantool() (func(), err) { |
It is more usual way. Up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the patch.
78357c2
to
079cd8d
Compare
- `Converter[S,T]`: this in an interface for converting from S to T. Some basic converters were implemented: - converters from string to golang types - `IdentityConverter[S]`: a converter from S to any that doesn't change the input. - `FuncConverter[S,T]`: a converter based on the function. - `Mapper`: this is a struct, that maps tuples, using converter list. `Mapper` can be built using an array of converters, where each converter will be aplied to the corresponding index of the tuple. Also possible set a default converter, that will be aplied if the tuple length exceeds the length of the primary converters list. - `tt`: these are auxiliary functions used to build a converters list for the `Mapper`. - `TTConvFactory` is an abstract facture that can build a converter from type T to each tarantool type. To customize the behavior for specific types, one can inherit from the existing factory and override the necessary methods. - `StringToTTConvFactory` is the `TTConvFactory` implementation for strings to tt conversion. - `MakeTypeTTConverters[Type]` creates list of the converters from `Type` to tt types by the factory and space format. Closes #1
Converter[S,T]
: this in an interface for converting from S to T.Some basic converters were implemented:
converters from string to golang types
IdentityConverter[S]
: a converter from S to any that doesn't change the input.FuncConverter[S,T]
: a converter based on the function.Mapper
: this is a struct, that maps tuples, using converter list.Mapper
can be built using an array of converters, where each converterwill be aplied to the corresponding index of the tuple.
Also possible set a default converter, that will be aplied if the tuple length
exceeds the length of the primary converters list.
tt
: these are auxiliary functionsused to build a converters list for the
Mapper
.TTConvFactory
is an abstract facture that can builda converter from type T to each tarantool type.
To customize the behavior for specific types, one can inherit from the
existing factory and override the necessary methods.
StringToTTConvFactory
is theTTConvFactory
implementation for strings to tt conversion.
MakeTypeTTConverters[Type]
creates list ofthe converters from
Type
to tt types by the factory and space format.Closes #1