Documentation ¶
Index ¶
- Constants
- Variables
- func AppPath(elem ...string) string
- func CompareHashAndPassword(hash, password string) error
- func CountTypeDocs(index string, logType string) float64
- func DeleteType(index string, logType string)
- func ExtractApiKey(message string) (string, string, error)
- func GetConnection() *goes.Connection
- func GetTypes(index string) ([]string, error)
- func HashPassword(password string) (string, error)
- func RemoveApiKey(message string) string
- func SendToElastic(url string, method string, b []byte) (string, error)
- type EnableValidation
- type IndexMapping
- type LogRecord
- type Project
- type User
Constants ¶
View Source
const ( ES_HOST = "127.0.0.1" ES_PORT = "9200" )
View Source
const (
// Api key and log type regex
ApiKeyFormat = `^([a-z0-9]{8}-[a-z0-9]{4}-[1-5][a-z0-9]{3}-[a-z0-9]{4}-[a-z0-9]{12})@([a-z0-9\_]{1,20})`
)
Variables ¶
View Source
var ( ErrSendingElasticSearchRequest = errors.New("Error sending request to ES.") ErrCreatingHttpRequest = errors.New("Could not create http.NewRequest") ErrReadResponse = errors.New("Could not read ES response") ErrDecodingJson = errors.New("Error decoding ES response") )
View Source
var (
ErrExtractingKey = errors.New("Error extracting key and type")
)
Functions ¶
func CompareHashAndPassword ¶
func CountTypeDocs ¶
Count documents in collection
func DeleteType ¶
func ExtractApiKey ¶
Extracts api key and log type from string
func GetConnection ¶
func GetConnection() *goes.Connection
func HashPassword ¶
func RemoveApiKey ¶
Removes api key and log type from string
Types ¶
type EnableValidation ¶
type EnableValidation struct {
Valid validation.Validation
}
func (*EnableValidation) GetError ¶
func (this *EnableValidation) GetError(key string) string
type IndexMapping ¶
type Project ¶
type Project struct { Id string `json:"id"` Name string `json:"name"` Description string `json:"description"` Types []string `json:"types"` }
Project represent group of log types. Each log type can be in various groups at the same time.
type User ¶
type User struct { Id string `json:"id"` Email string `json:"email"` FirstName string `json:"firstName"` LastName string `json:"lastName"` Password string `json:"password"` ApiKey string `json:"apiKey"` Projects []*Project `json:"projects"` }
func FindCachedUser ¶
Search user and store record in memory
func FindUserBy ¶
Find user by any param. Returns err if ES can't perform/accept query, and nil if user not found.
func FindUserByApiKey ¶
func FindUserByEmail ¶
func (*User) AddProject ¶
func (*User) DeleteProject ¶
func (*User) GetIndexName ¶
Returns index name to use in Elastic
func (*User) UpdateProject ¶
Click to show internal directories.
Click to hide internal directories.