You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OneAuth/models/index/index.go

44 lines
895 B
Go

3 years ago
package index
import (
"github.com/olivere/elastic/v7"
"github.com/veypi/OneAuth/cfg"
)
type index string
const (
File index = "file"
History index = "history"
)
func (i index) String() string {
return string(i)
}
func (i index) Count() *elastic.CountService {
return cfg.ES().Count().Index(string(i))
}
func (i index) Index() *elastic.IndexService {
return cfg.ES().Index().Index(string(i))
}
func (i index) Get() *elastic.GetService {
return cfg.ES().Get().Index(string(i))
}
func (i index) Update() *elastic.UpdateService {
return cfg.ES().Update().Index(string(i))
}
func (i index) Search() *elastic.SearchService {
return cfg.ES().Search().Index(string(i))
}
func (i index) Delete() *elastic.DeleteService {
return cfg.ES().Delete().Index(string(i))
}
func (i index) DeleteByQuery() *elastic.DeleteByQueryService {
return cfg.ES().DeleteByQuery().Index(string(i))
}