Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement new storage with gorm and storm #1995

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions db/AccessKey.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ type AccessKey struct {
LoginPassword LoginPassword `db:"-" json:"login_password"`
SshKey SshKey `db:"-" json:"ssh"`
OverrideSecret bool `db:"-" json:"override_secret"`

RepositorySSHKeys []*Repository `gorm:"foreignKey:SSHKeyID" json:"-"`
InventorySSHKeys []*Inventory `gorm:"foreignKey:SSHKeyID" json:"-"`
InventoryBecomeKeys []*Inventory `gorm:"foreignKey:BecomeKeyID" json:"-"`
TemplateVaultKeys []*Template `gorm:"foreignKey:VaultKeyID" json:"-"`
}

type LoginPassword struct {
Expand Down
121 changes: 121 additions & 0 deletions db/params.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
package db

type EventParams struct {
UserID int
ProjectID int
Query RetrieveQueryParams
}

type UserParams struct {
UserID int
Password string
Query RetrieveQueryParams
}

type TokenParams struct {
UserID int
TokenID string
}

type SessionParams struct {
UserID int
SessionID string
}

type RunnerParams struct {
RunnerID int
ProjectID int
}

type ProjectParams struct {
Admin bool
UserID int
ProjectID int
}

type MemberParams struct {
ProjectID int
UserID int
Query RetrieveQueryParams
}

type TemplateParams struct {
ProjectID int
TemplateID int
Filter TemplateFilter
Query RetrieveQueryParams
}

type AccessKeyParams struct {
ProjectID int
AccessKeyID int
OldKey string
Query RetrieveQueryParams
}

type EnvParams struct {
ProjectID int
EnvironmentID int
Query RetrieveQueryParams
}

type InventoryParams struct {
ProjectID int
InventoryID int
Query RetrieveQueryParams
}

type RepoParams struct {
ProjectID int
RepositoryID int
Query RetrieveQueryParams
}

type ViewParams struct {
ProjectID int
ViewID int
Positions map[int]int
Query RetrieveQueryParams
}

type ScheduleParams struct {
ProjectID int
ScheduleID int
TemplateID int
Hash string
Query RetrieveQueryParams
}

type TaskParams struct {
ProjectID int
TaskID int
TemplateID int
Query RetrieveQueryParams
}

type IntegrationParams struct {
ProjectID int
IntegrationID int
Alias string
Query RetrieveQueryParams
}

type IntegrationExtractValueParams struct {
ProjectID int
IntegrationID int
ValueID int
Query RetrieveQueryParams
}

type IntegrationMatcherParams struct {
ProjectID int
IntegrationID int
MatcherID int
Query RetrieveQueryParams
}

type IntegrationAliasParams struct {
ProjectID int
IntegrationID int
AliasID int
}
21 changes: 21 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ go 1.21

require (
github.com/Masterminds/squirrel v1.5.4
github.com/asdine/storm/v3 v3.2.1
github.com/coreos/go-oidc/v3 v3.9.0
github.com/creack/pty v1.1.21
github.com/glebarez/sqlite v1.11.0
github.com/go-git/go-git/v5 v5.11.0
github.com/go-gormigrate/gormigrate/v2 v2.1.2
github.com/go-gorp/gorp/v3 v3.1.0
github.com/go-ldap/ldap/v3 v3.4.6
github.com/go-sql-driver/mysql v1.7.1
Expand All @@ -17,6 +20,7 @@ require (
github.com/gorilla/securecookie v1.1.2
github.com/gorilla/websocket v1.5.1
github.com/lib/pq v1.10.9
github.com/pkg/errors v0.9.1
github.com/robfig/cron/v3 v3.0.1
github.com/sirupsen/logrus v1.9.3
github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa
Expand All @@ -25,6 +29,9 @@ require (
go.etcd.io/bbolt v1.3.9
golang.org/x/crypto v0.21.0
golang.org/x/oauth2 v0.17.0
gorm.io/driver/mysql v1.5.6
gorm.io/driver/postgres v1.5.7
gorm.io/gorm v1.25.10
)

require (
Expand All @@ -34,8 +41,10 @@ require (
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/glebarez/go-sqlite v1.21.2 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.5 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
Expand All @@ -45,11 +54,18 @@ require (
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgx/v5 v5.4.3 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/skeema/knownhosts v1.2.1 // indirect
Expand All @@ -58,8 +74,13 @@ require (
golang.org/x/mod v0.15.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.18.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
modernc.org/libc v1.22.5 // indirect
modernc.org/mathutil v1.5.0 // indirect
modernc.org/memory v1.5.0 // indirect
modernc.org/sqlite v1.23.1 // indirect
)