Skip to main content

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.

TypeSortFacet
stringyesyes
boolyesyes
int32yesyes
int64yesyes
float64yesyes
time.Timeyesno
objectyesyes
arraynoyes
note

In case of an struct type field, sort and facet properties apply to its nested fields.