renamed daos.GetTableColumns and daos.GetTableInfo for consistency
This commit is contained in:
@@ -158,9 +158,7 @@ func (form *CollectionUpsert) Validate() error {
|
||||
validation.When(isView, validation.Nil),
|
||||
validation.By(form.checkRule),
|
||||
),
|
||||
validation.Field(&form.Indexes,
|
||||
validation.When(isView, validation.Length(0, 0)).Else(validation.By(form.checkIndexes)),
|
||||
),
|
||||
validation.Field(&form.Indexes, validation.By(form.checkIndexes)),
|
||||
validation.Field(&form.Options, validation.By(form.checkOptions)),
|
||||
)
|
||||
}
|
||||
@@ -390,6 +388,13 @@ func (form *CollectionUpsert) checkRule(value any) error {
|
||||
func (form *CollectionUpsert) checkIndexes(value any) error {
|
||||
v, _ := value.(types.JsonArray[string])
|
||||
|
||||
if form.Type == models.CollectionTypeView && len(v) > 0 {
|
||||
return validation.NewError(
|
||||
"validation_indexes_not_supported",
|
||||
fmt.Sprintf("The collection doesn't support indexes."),
|
||||
)
|
||||
}
|
||||
|
||||
for i, rawIndex := range v {
|
||||
parsed := dbutils.ParseIndex(rawIndex)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user