mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2026-04-25 12:07:48 +02:00
feat: demo flags (#1084)
This commit is contained in:
@@ -3,6 +3,7 @@ package app
|
||||
import (
|
||||
"slices"
|
||||
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -10,6 +11,23 @@ import (
|
||||
"github.com/SecurityBrewery/catalyst/migrations"
|
||||
)
|
||||
|
||||
func HasFlag(app core.App, flag string) bool {
|
||||
records, err := app.Dao().FindRecordsByExpr(migrations.FeatureCollectionName, dbx.HashExp{"name": flag})
|
||||
if err != nil {
|
||||
app.Logger().Error(err.Error())
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
for _, r := range records {
|
||||
if r.GetString("name") == flag {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func Flags(app core.App) ([]string, error) {
|
||||
records, err := app.Dao().FindRecordsByExpr(migrations.FeatureCollectionName)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user