aboutsummaryrefslogtreecommitdiffstats
path: root/models/packages
diff options
context:
space:
mode:
Diffstat (limited to 'models/packages')
-rw-r--r--models/packages/package_version.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/models/packages/package_version.go b/models/packages/package_version.go
index 583f832e5e..83c2fdb674 100644
--- a/models/packages/package_version.go
+++ b/models/packages/package_version.go
@@ -107,7 +107,7 @@ func getVersionByNameAndVersion(ctx context.Context, ownerID int64, packageType
ExactMatch: true,
Value: version,
},
- IsInternal: isInternal,
+ IsInternal: util.OptionalBoolOf(isInternal),
Paginator: db.NewAbsoluteListOptions(0, 1),
})
if err != nil {
@@ -171,7 +171,7 @@ type PackageSearchOptions struct {
Name SearchValue // only results with the specific name are found
Version SearchValue // only results with the specific version are found
Properties map[string]string // only results are found which contain all listed version properties with the specific value
- IsInternal bool
+ IsInternal util.OptionalBool
HasFileWithName string // only results are found which are associated with a file with the specific name
HasFiles util.OptionalBool // only results are found which have associated files
Sort string
@@ -179,7 +179,10 @@ type PackageSearchOptions struct {
}
func (opts *PackageSearchOptions) toConds() builder.Cond {
- var cond builder.Cond = builder.Eq{"package_version.is_internal": opts.IsInternal}
+ cond := builder.NewCond()
+ if !opts.IsInternal.IsNone() {
+ cond = builder.Eq{"package_version.is_internal": opts.IsInternal.IsTrue()}
+ }
if opts.OwnerID != 0 {
cond = cond.And(builder.Eq{"package.owner_id": opts.OwnerID})