mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-07 03:17:50 +00:00
Add IndexOptions to IndexInfo json response
This commit is contained in:
parent
9be45bcd60
commit
29eba09e1e
3 changed files with 4 additions and 3 deletions
|
|
@ -232,7 +232,7 @@ func (h *Holder) Schema() []*IndexInfo {
|
|||
func (h *Holder) limitedSchema() []*IndexInfo {
|
||||
var a []*IndexInfo
|
||||
for _, index := range h.Indexes() {
|
||||
di := &IndexInfo{Name: index.Name()}
|
||||
di := &IndexInfo{Name: index.Name(), Options: index.Options()}
|
||||
for _, field := range index.Fields() {
|
||||
fi := &FieldInfo{Name: field.Name(), Options: field.Options()}
|
||||
di.Fields = append(di.Fields, fi)
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ func TestPostIndexRequestUnmarshalJSON(t *testing.T) {
|
|||
err string
|
||||
}{
|
||||
{json: `{"options": {}}`, expected: postIndexRequest{Options: pilosa.IndexOptions{}}},
|
||||
{json: `{"options": {"keys": true}}`, expected: postIndexRequest{Options: pilosa.IndexOptions{true}}},
|
||||
{json: `{"options": 4}`, err: "options is not map[string]interface{}"},
|
||||
{json: `{"option": {}}`, err: "Unknown key: option:map[]"},
|
||||
{json: `{"options": {"badKey": "test"}}`, err: "Unknown key: badKey:test"},
|
||||
|
|
|
|||
4
index.go
4
index.go
|
|
@ -95,7 +95,7 @@ func (i *Index) Options() IndexOptions {
|
|||
}
|
||||
|
||||
func (i *Index) options() IndexOptions {
|
||||
return IndexOptions{}
|
||||
return IndexOptions{i.keys}
|
||||
}
|
||||
|
||||
// Open opens and initializes the index.
|
||||
|
|
@ -406,7 +406,7 @@ func (p indexSlice) Less(i, j int) bool { return p[i].Name() < p[j].Name() }
|
|||
// IndexInfo represents schema information for an index.
|
||||
type IndexInfo struct {
|
||||
Name string `json:"name"`
|
||||
options IndexOptions `json:"options"`
|
||||
Options IndexOptions `json:"options"`
|
||||
Fields []*FieldInfo `json:"fields"`
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue