Data Types
Tigris supports all of the TypeScript types while also providing support for custom types via classes.
Strings
type Post struct {
Title string
Author string `tigris:"facet,sort"`
}
Boolean
type Post struct {
Pinned bool
Active bool `tigris:"facet,sort"`
}
Numbers
type Post struct {
Views int64
AuthorID int64 `tigris:"facet,sort"`
}
Dates
type Post struct {
PublishedAt time.Time `tigris:"sort"`
}
Vectors
type Post struct {
Title string
Author string `tigris:"facet,sort"`
VecField [1536]float64 `json:"vec_field" tigris:"vector"`
}
Objects
User-defined classes and objects are supported. Fields can be of any type, there is no restriction.
type Bio struct {
Text string
CreatedAt time.Time `tigris:"sort"`
}
type Author struct {
Bio Bio;
}
Arrays
Arrays of all the above types are supported. There is no restriction.
type Post struct {
Tags []string `tigris:"facet"`
Comments []Comment
}
Sorting and Faceting
Tigris supports the majority of the primitive Golang types while also providing support for custom types.
Type | Sort | Facet |
---|---|---|
string | yes | yes |
bool | yes | yes |
int32 | yes | yes |
int64 | yes | yes |
float64 | yes | yes |
time.Time | yes | no |
object | yes | yes |
array | no | yes |
note
In case of an struct type field, sort
and facet
properties apply to its nested fields.