Documentation
¶
Index ¶
- type Index
- func (i *Index) Create(index string, options types.QueryOptions) error
- func (i *Index) Delete(index string, options types.QueryOptions) error
- func (i *Index) Exists(index string, options types.QueryOptions) (bool, error)
- func (i *Index) List(options types.QueryOptions) ([]string, error)
- func (i *Index) MDelete(indexes []string, options types.QueryOptions) ([]string, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index controller
func (*Index) Create ¶
func (i *Index) Create(index string, options types.QueryOptions) error
Create a new empty data index, with no associated mapping.
Example ¶
package main import ( "fmt" "github.com/kuzzleio/sdk-go/index" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/protocol/websocket" ) func main() { conn := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(conn, nil) i := index.NewIndex(k) err := i.Create("index", nil) if err != nil { fmt.Println(err.Error()) return } }
func (*Index) Delete ¶
func (i *Index) Delete(index string, options types.QueryOptions) error
Delete the given index
Example ¶
package main import ( "fmt" "github.com/kuzzleio/sdk-go/index" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/protocol/websocket" ) func main() { conn := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(conn, nil) i := index.NewIndex(k) i.Create("index", nil) err := i.Delete("index", nil) if err != nil { fmt.Println(err.Error()) return } }
func (*Index) Exists ¶
Exists check if the index exists
Example ¶
package main import ( "fmt" "github.com/kuzzleio/sdk-go/index" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/protocol/websocket" ) func main() { conn := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(conn, nil) i := index.NewIndex(k) i.Create("index", nil) _, err := i.Exists("index", nil) if err != nil { fmt.Println(err.Error()) return } }
func (*Index) List ¶
func (i *Index) List(options types.QueryOptions) ([]string, error)
List all index
Example ¶
package main import ( "fmt" "github.com/kuzzleio/sdk-go/index" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" ) func main() { c := &internal.MockedConnection{} k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) res, err := i.List(nil) if err != nil { fmt.Println(err.Error()) return } fmt.Println(res) }
func (*Index) MDelete ¶
MDelete deletes all matching indices at once
Example ¶
package main import ( "fmt" "github.com/kuzzleio/sdk-go/index" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/protocol/websocket" ) func main() { conn := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(conn, nil) i := index.NewIndex(k) i.Create("index1", nil) i.Create("index2", nil) indexes := []string{ "index1", "index2", } _, err := i.MDelete(indexes, nil) if err != nil { fmt.Println(err.Error()) return } }
Click to show internal directories.
Click to hide internal directories.