Skip to content

Conversation

askalt
Copy link
Contributor

@askalt askalt commented Jul 27, 2023

  • 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

@askalt askalt changed the title Askalt/no gh initial logic tupleconv: initial logic Jul 27, 2023
@askalt askalt force-pushed the askalt/no-gh-initial-logic branch 3 times, most recently from 5136736 to d914e0e Compare July 28, 2023 06:38
@psergee
Copy link

psergee commented Jul 28, 2023

Can you please add some usage examples to the description of this PR?

@DifferentialOrange
Copy link
Member

DifferentialOrange commented Jul 28, 2023

Relates to #1

Allowed comments are Part of #1, Closes #1, Follows #1 depending on what exactly is happening.

@askalt askalt force-pushed the askalt/no-gh-initial-logic branch 2 times, most recently from eee12c2 to 6c6b25a Compare July 28, 2023 07:29
@askalt
Copy link
Contributor Author

askalt commented Jul 28, 2023

Can you please add some usage examples to the description of this PR?

Sure, added.

@askalt askalt force-pushed the askalt/no-gh-initial-logic branch 3 times, most recently from 53c4951 to d2105f6 Compare July 28, 2023 08:55
@psergee
Copy link

psergee commented Jul 28, 2023

Pls, add description and examples to readme.

@askalt askalt force-pushed the askalt/no-gh-initial-logic branch from ff50cbc to d15c01a Compare July 28, 2023 11:11
@askalt askalt force-pushed the askalt/no-gh-initial-logic branch from 5c1090d to 9056f9e Compare August 5, 2023 10:29
@askalt askalt force-pushed the askalt/no-gh-initial-logic branch 15 times, most recently from a32e548 to 66d1450 Compare August 7, 2023 13:56
@askalt askalt requested a review from oleg-jukovec August 7, 2023 15:48
example_test.go Outdated
Comment on lines 180 to 187
if err != nil {
fmt.Println(err)
return nil
}
Copy link
Contributor

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.

Suggested change
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() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func upTarantool() func() {
func upTarantool() (func(), err) {

It is more usual way. Up to you.

Copy link
Contributor

@oleg-jukovec oleg-jukovec left a 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.

@askalt askalt force-pushed the askalt/no-gh-initial-logic branch 4 times, most recently from 78357c2 to 079cd8d Compare August 8, 2023 14:21
askalt added 3 commits August 8, 2023 17:21
- `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
@askalt askalt merged commit 2fab271 into master Aug 9, 2023
@askalt askalt deleted the askalt/no-gh-initial-logic branch August 9, 2023 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API (and internals) introducing
4 participants