Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
perxis-go
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
perxis
perxis-go
Commits
79c844e3
Commit
79c844e3
authored
2 years ago
by
ko_oler
Browse files
Options
Downloads
Patches
Plain Diff
перенос func UpdateCollectionSchemaMetadata() в пакет extension
parent
480677cf
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pkg/extension/extension.go
+18
-0
18 additions, 0 deletions
pkg/extension/extension.go
pkg/setup/collection.go
+0
-16
0 additions, 16 deletions
pkg/setup/collection.go
with
18 additions
and
16 deletions
pkg/extension/extension.go
+
18
−
0
View file @
79c844e3
...
@@ -4,9 +4,11 @@ import (
...
@@ -4,9 +4,11 @@ import (
"context"
"context"
"fmt"
"fmt"
"git.perx.ru/perxis/perxis-go/pkg/collections"
"git.perx.ru/perxis/perxis-go/pkg/content"
"git.perx.ru/perxis/perxis-go/pkg/content"
"git.perx.ru/perxis/perxis-go/pkg/errors"
"git.perx.ru/perxis/perxis-go/pkg/errors"
"git.perx.ru/perxis/perxis-go/pkg/items"
"git.perx.ru/perxis/perxis-go/pkg/items"
"git.perx.ru/perxis/perxis-go/pkg/setup"
pb
"git.perx.ru/perxis/perxis-go/proto/extensions"
pb
"git.perx.ru/perxis/perxis-go/proto/extensions"
)
)
...
@@ -105,3 +107,19 @@ func ExtensionFromError(err error) string {
...
@@ -105,3 +107,19 @@ func ExtensionFromError(err error) string {
ext
,
_
:=
v
.
(
string
)
ext
,
_
:=
v
.
(
string
)
return
ext
return
ext
}
}
func
UpdateCollectionSchemaMetadata
()
setup
.
CollectionsOption
{
return
func
(
c
*
setup
.
CollectionConfig
)
{
c
.
UpdateFn
=
func
(
s
*
setup
.
Setup
,
exist
,
new
*
collections
.
Collection
)
(
coll
*
collections
.
Collection
,
upd
bool
,
setSchema
bool
,
err
error
)
{
if
!
new
.
IsView
()
&&
!
exist
.
IsView
()
{
if
new
.
Schema
.
Metadata
!=
nil
&&
exist
.
Schema
.
Metadata
==
nil
&&
!
s
.
IsForce
()
{
return
nil
,
false
,
false
,
collections
.
ErrAlreadyExists
}
if
new
.
Schema
.
Metadata
!=
nil
&&
exist
.
Schema
.
Metadata
!=
nil
{
return
new
,
true
,
true
,
nil
}
}
return
new
,
true
,
true
,
nil
}
}
}
This diff is collapsed.
Click to expand it.
pkg/setup/collection.go
+
0
−
16
View file @
79c844e3
...
@@ -80,22 +80,6 @@ func UpdateExistingCollection() CollectionsOption {
...
@@ -80,22 +80,6 @@ func UpdateExistingCollection() CollectionsOption {
}
}
}
}
func
UpdateCollectionSchemaMetadata
()
CollectionsOption
{
return
func
(
c
*
CollectionConfig
)
{
c
.
UpdateFn
=
func
(
s
*
Setup
,
exist
,
new
*
collections
.
Collection
)
(
coll
*
collections
.
Collection
,
upd
bool
,
setSchema
bool
,
err
error
)
{
if
!
new
.
IsView
()
&&
!
exist
.
IsView
()
{
if
new
.
Schema
.
Metadata
!=
nil
&&
exist
.
Schema
.
Metadata
==
nil
&&
!
s
.
IsForce
()
{
return
nil
,
false
,
false
,
collections
.
ErrAlreadyExists
}
if
new
.
Schema
.
Metadata
!=
nil
&&
exist
.
Schema
.
Metadata
!=
nil
{
return
new
,
true
,
true
,
nil
}
}
return
new
,
true
,
true
,
nil
}
}
}
func
(
s
*
Setup
)
InstallCollections
(
ctx
context
.
Context
)
(
err
error
)
{
func
(
s
*
Setup
)
InstallCollections
(
ctx
context
.
Context
)
(
err
error
)
{
if
len
(
s
.
Collections
)
==
0
{
if
len
(
s
.
Collections
)
==
0
{
return
nil
return
nil
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment