mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-28 19:12:02 +08:00

* feat: added license manager and feature flags * feat: completed org domain api * chore: checking in saml auth handler code * feat: added signup with sso * feat: added login support for admins * feat: added pem support for certificate * ci(build-workflow): 👷 include EE query-service * fix: 🐛 update package name * chore(ee): 🔧 LD_FLAGS related changes Signed-off-by: Prashant Shahi <prashant@signoz.io> Co-authored-by: Prashant Shahi <prashant@signoz.io> Co-authored-by: nityanandagohain <nityanandagohain@gmail.com>
41 lines
1.0 KiB
Go
41 lines
1.0 KiB
Go
package logs
|
|
|
|
import (
|
|
"fmt"
|
|
"regexp"
|
|
|
|
"go.signoz.io/signoz/pkg/query-service/constants"
|
|
"go.signoz.io/signoz/pkg/query-service/model"
|
|
)
|
|
|
|
func ValidateUpdateFieldPayload(field *model.UpdateField) error {
|
|
if field.Name == "" {
|
|
return fmt.Errorf("name cannot be empty")
|
|
}
|
|
if field.Type == "" {
|
|
return fmt.Errorf("type cannot be empty")
|
|
}
|
|
if field.DataType == "" {
|
|
return fmt.Errorf("dataType cannot be empty")
|
|
}
|
|
|
|
matched, err := regexp.MatchString(fmt.Sprintf("^(%s|%s|%s)$", constants.Static, constants.Attributes, constants.Resources), field.Type)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if !matched {
|
|
return fmt.Errorf("type %s not supported", field.Type)
|
|
}
|
|
|
|
if field.IndexType != "" {
|
|
matched, err := regexp.MatchString(`^(minmax|set\([0-9]\)|bloom_filter\((0?.?[0-9]+|1)\)|tokenbf_v1\([0-9]+,[0-9]+,[0-9]+\)|ngrambf_v1\([0-9]+,[0-9]+,[0-9]+,[0-9]+\))$`, field.IndexType)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if !matched {
|
|
return fmt.Errorf("index type %s not supported", field.IndexType)
|
|
}
|
|
}
|
|
return nil
|
|
}
|