Skip to content
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

api: add CRUD module support #263

Merged
merged 1 commit into from
Mar 8, 2023
Merged

Conversation

AnaNek
Copy link

@AnaNek AnaNek commented Jan 12, 2023

This patch provides crud methods as request objects to support CRUD API.
The following methods are supported:

  • insert
  • insert_object
  • insert_many
  • insert_object_many
  • get
  • update
  • delete
  • replace
  • replace_object
  • replace_many
  • replace_object_many
  • upsert
  • upsert_object
  • upsert_many
  • upsert_object_many
  • select
  • min
  • max
  • truncate
  • len
  • storage_info
  • count
  • stats
  • unflatten_rows

Example:

    conn, err = Connect(server, opts)
    defer conn.Close()

    var conditions = []crud.Condition{
	{
		Operator: crud.LT,
		KeyName:  "id",
		KeyValue: uint(1020),
	},
    }

    var selectOpts = crud.SelectOpts{
	Timeout: crud.NewOptUint(timeout),
    }

    req := crud.NewSelectRequest(spaceName).
		Conditions(conditions).
		Opts(selectOpts)
	
    resp, err := conn.Do(req).Get()

Closes #108

@AnaNek AnaNek marked this pull request as draft January 12, 2023 10:24
@AnaNek AnaNek requested a review from oleg-jukovec January 12, 2023 10:25
Copy link
Collaborator

@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.

Thanks for the patch, I like this start.

crud/request.go Outdated Show resolved Hide resolved
crud/request.go Outdated Show resolved Hide resolved
crud/tarantool_test.go Show resolved Hide resolved
@AnaNek AnaNek force-pushed the AnaNek/gh-108-crud-api branch 26 times, most recently from 86a52f6 to 970d0eb Compare January 23, 2023 09:47
@AnaNek AnaNek force-pushed the AnaNek/gh-108-crud-api branch from 970d0eb to 0915260 Compare January 24, 2023 08:18
@AnaNek AnaNek force-pushed the AnaNek/gh-108-crud-api branch 4 times, most recently from 8019e08 to 7ecc243 Compare February 27, 2023 15:59
Copy link
Collaborator

@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 a lot of work done.

crud/options.go Show resolved Hide resolved
crud/options.go Outdated Show resolved Hide resolved
@AnaNek AnaNek force-pushed the AnaNek/gh-108-crud-api branch 2 times, most recently from d8a3a5d to 1d890bc Compare March 3, 2023 09:54
@AnaNek AnaNek requested a review from oleg-jukovec March 3, 2023 11:04
crud/error.go Outdated Show resolved Hide resolved
Copy link
Member

@DifferentialOrange DifferentialOrange 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 updates! I think we'll be ready to merge this one after we clear up _many errors case

Makefile Outdated Show resolved Hide resolved
crud/error.go Outdated Show resolved Hide resolved
crud/tarantool_test.go Show resolved Hide resolved
@AnaNek AnaNek force-pushed the AnaNek/gh-108-crud-api branch 4 times, most recently from 1af7a63 to 0f530c4 Compare March 6, 2023 14:49
crud/error.go Outdated Show resolved Hide resolved
crud/error.go Outdated Show resolved Hide resolved
crud/upsert_many.go Outdated Show resolved Hide resolved
Copy link
Member

@DifferentialOrange DifferentialOrange 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 updates and sorry for the long process! Approved from my side

@AnaNek AnaNek force-pushed the AnaNek/gh-108-crud-api branch 3 times, most recently from c86f41d to a78a791 Compare March 7, 2023 11:30
Copy link
Collaborator

@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.

Could you please create an issue with missing functionality?

I think there should be at least:

1. Implement an ability to decode custom types via Result/ResultMany.

But maybe something else?

@AnaNek AnaNek mentioned this pull request Mar 7, 2023
This patch provides crud [1] methods as request objects to support CRUD API.
The following methods are supported:

* `insert`
* `insert_object`
* `insert_many`
* `insert_object_many`
* `get`
* `update`
* `delete`
* `replace`
* `replace_object`
* `replace_many`
* `replace_object_many`
* `upsert`
* `upsert_object`
* `upsert_many`
* `upsert_object_many`
* `select`
* `min`
* `max`
* `truncate`
* `len`
* `storage_info`
* `count`
* `stats`
* `unflatten_rows`

1. https://github.com/tarantool/crud

Closes #108
@oleg-jukovec oleg-jukovec force-pushed the AnaNek/gh-108-crud-api branch from a78a791 to 5543374 Compare March 8, 2023 08:22
@oleg-jukovec oleg-jukovec merged commit 1469484 into master Mar 8, 2023
@oleg-jukovec oleg-jukovec deleted the AnaNek/gh-108-crud-api branch March 8, 2023 09:13
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.

Convenient API for calls to tarantool/crud
3 participants