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

Total item count #22

Open
PascalLeMerrer opened this issue Dec 8, 2015 · 4 comments
Open

Total item count #22

PascalLeMerrer opened this issue Dec 8, 2015 · 4 comments

Comments

@PascalLeMerrer
Copy link
Contributor

How could I get the total number of items when I get a subset using the limit parameter?
The fullcount property is always 0, event when the AQL request contains a "LIMIT" clause.

@diegogub
Copy link
Owner

diegogub commented Dec 9, 2015

Hello @PascalLeMerrer ,
I added a function to set fullCount option:
https://gowalker.org/github.com/diegogub/aranGO#Query_SetFullCount

I'm working in a v2 release, with much more intuitive api, hopefully I will be able to finish it in a few weeks, as I'm very busy with work ! I will keep you updated if you want

Regards

@PascalLeMerrer
Copy link
Contributor Author

Many thanks!
I'm very interested in this V2, and my have a few suggestions. Should I create a new issue about them?

@PascalLeMerrer
Copy link
Contributor Author

It doesn't seem to work. Maybe it's a usage problem on my side?
My code is something like:

    queryString := "FOR u in users  SORT u.createdAt DESC LIMIT 0, 20 RETURN u"
    arangoQuery := ara.NewQuery(queryString)
    arangoQuery.SetFullCount(true)
    cursor, err := config.Db().Execute(arangoQuery)

    if err != nil {
        fmt.Println(err)
        return nil, 0, err
    }
    result := make([]User, len(cursor.Result))
    err = cursor.FetchBatch(&result)
    if err != nil {
        fmt.Println(err)
        return nil, 0, err
    }
    return result, cursor.FullCount(), nil

@PascalLeMerrer
Copy link
Contributor Author

The problem is in the unmarshalling of the response of the database. The fullcount field is not in extra, but in extra.stats. I will make a pull request with a fix.

PascalLeMerrer pushed a commit to PascalLeMerrer/aranGO that referenced this issue Dec 10, 2015
diegogub pushed a commit that referenced this issue Dec 11, 2015
Fixed issue #22: total item count is 0.
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

No branches or pull requests

2 participants