go-bond / bond

Other
10 stars 3 forks source link

Multi and Range index bucket selectors #95

Closed marino39 closed 1 year ago

marino39 commented 1 year ago

Description: The feature allows selecting multiple index buckets or ranges at the same time. This lets us do filtering directly on indexes without a need to deserialize fields. Therefore making queries much more efficient.

Example:

type UserType byte

const (
     RegularUserType UserType = 0
     WriterUserType UserType = 1
     SuperUserType UserType = 2
     EndUsersType UserTyoe = 3
)

type User struct {
    ID uint64
    Type UserType
    Name string
    Surname string
    Bio string
}

var UserTypeIndex Index[User]

var users []User

// Query User where  0 <=Type < 3
Table.Query(UserTypeIndex, User{Type: RegularUserType}, User{Type: EndUserType}).Execute(ctx, &users)