Some improvements
This commit is contained in:
@@ -32,12 +32,12 @@ var nameRE = regexp.MustCompile("[^a-zA-Z0-9-_.]+")
|
||||
// Secret represents a secret
|
||||
type Secret struct {
|
||||
ID int64
|
||||
UserID int64 `xorm:"index"`
|
||||
RepoID int64 `xorm:"index"`
|
||||
Name string
|
||||
Data string
|
||||
PullRequest bool
|
||||
CreatedUnix timeutil.TimeStamp `xorm:"created"`
|
||||
UserID int64 `xorm:"index NOTNULL"`
|
||||
RepoID int64 `xorm:"index NOTNULL"`
|
||||
Name string `xorm:"NOTNULL"`
|
||||
Data string `xorm:"TEXT"`
|
||||
PullRequest bool `xorm:"NOTNULL"`
|
||||
CreatedUnix timeutil.TimeStamp `xorm:"created NOTNULL"`
|
||||
}
|
||||
|
||||
// Validate validates the required fields and formats.
|
||||
|
||||
@@ -35,6 +35,7 @@ const (
|
||||
SearchOrderByForksReverse SearchOrderBy = "num_forks DESC"
|
||||
)
|
||||
|
||||
// FindObjects represents a common function to find Objects from database according cond and ListOptions
|
||||
func FindObjects[Object any](ctx context.Context, cond builder.Cond, opts *ListOptions, objects *[]*Object) error {
|
||||
sess := GetEngine(ctx).Where(cond)
|
||||
if opts != nil && opts.PageSize > 0 {
|
||||
|
||||
@@ -13,12 +13,12 @@ import (
|
||||
func createSecretsTable(x *xorm.Engine) error {
|
||||
type Secret struct {
|
||||
ID int64
|
||||
UserID int64 `xorm:"index"`
|
||||
RepoID int64 `xorm:"index"`
|
||||
Name string
|
||||
Data string
|
||||
PullRequest bool
|
||||
CreatedUnix timeutil.TimeStamp `xorm:"created"`
|
||||
UserID int64 `xorm:"index NOTNULL"`
|
||||
RepoID int64 `xorm:"index NOTNULL"`
|
||||
Name string `xorm:"NOTNULL"`
|
||||
Data string `xorm:"TEXT"`
|
||||
PullRequest bool `xorm:"NOTNULL"`
|
||||
CreatedUnix timeutil.TimeStamp `xorm:"created NOTNULL"`
|
||||
}
|
||||
|
||||
return x.Sync(new(Secret))
|
||||
|
||||
Reference in New Issue
Block a user