Documentation ¶
Index ¶
Constants ¶
const ( OrderAsc = "asc" OrderDesc = "desc" )
Variables ¶
var ErrNotFound = errors.New("object not found")
ErrNotFound represents a not found error
var NewAnalyzerDAO = func(config *shared.AppConfig) (AnalyzerDAO, error) { client, err := NewDBClient(config) if err != nil { return nil, err } err = client.AutoMigrate(analyzer.Analyzer{}) if err != nil { return nil, err } dao := &blobAnalyzerDAO{client: client, config: config} dao.preloadDefaultAnalyzersSilently(context.Background(), analyzersDataFile) return dao, nil }
NewAnalyzerDAO create AnalyzerDAO
var NewAnalyzerRuleDAO = func(config *shared.AppConfig) (AnalyzerRuleDAO, error) { shared.LogInfof("init NewAnalyzerRuleDAO") client, err := NewDBClient(config) if err != nil { return nil, err } err = client.AutoMigrate(analyzer.Rule{}) if err != nil { return nil, err } dao := &blobAnalyzerRuleDAO{client: client, config: config} err = dao.preloadDefaultAnalyzerRulesSilently(context.Background(), "internal/data", "rules") shared.LogInfof("preloading rules") if err != nil { shared.LogWarnf("failed to preload rules: %s", err.Error()) } else { shared.LogInfof("preloaded rules") } return dao, nil }
NewAnalyzerRuleDAO create AnalyzerRuleDAO
var NewOrganizationDAO = func(config *shared.AppConfig) (OrganizationDAO, error) { client, err := NewDBClient(config) if err != nil { return nil, err } err = client.AutoMigrate(models.Organization{}) if err != nil { return nil, err } dao := &blobOrganizationDAO{client: client, config: config} return dao, nil }
NewOrganizationDAO create OrganizationDAO
var NewServiceDAO = func(config *shared.AppConfig) (ServiceDAO, error) { client, err := NewDBClient(config) if err != nil { return nil, err } err = client.AutoMigrate(models.Service{}) if err != nil { return nil, err } dao := &blobServiceDAO{client: client, config: config} return dao, nil }
NewServiceDAO create ServiceDAO
var NewSpecAnalysisDAO = func(config *shared.AppConfig) (SpecAnalysisDAO, error) { client, err := NewDBClient(config) if err != nil { return nil, err } err = client.AutoMigrate(models.SpecAnalysis{}) if err != nil { return nil, err } dao := &blobSpecAnalysisDAO{client: client, config: config} return dao, nil }
NewSpecAnalysisDAO create SpecAnalysisDAO
var NewSpecDAO = func(config *shared.AppConfig) (SpecDAO, error) { client, err := NewDBClient(config) if err != nil { return nil, err } err = client.AutoMigrate(models.Spec{}) if err != nil { return nil, err } dao := &blobSpecDAO{client: client, config: config} return dao, nil }
NewSpecDAO create SpecDAO
var NewSpecDiffDAO = func(config *shared.AppConfig) (SpecDiffDAO, error) { client, err := NewDBClient(config) if err != nil { return nil, err } err = client.AutoMigrate(models.SpecDiff{}) if err != nil { return nil, err } dao := &blobSpecDiffDAO{client: client, config: config} return dao, nil }
NewSpecDiffDAO create SpecDiffDAO
Functions ¶
func ClientFlags ¶
func ClientFlags() []cli.Flag
ClientFlags returns cli flags for creating new db client
Types ¶
type AnalyzerDAO ¶
type AnalyzerDAO interface { List(context context.Context, filter *ListFilter, withRules bool) ([]*analyzer.Analyzer, error) Save(context context.Context, analyzer *analyzer.Analyzer) error Get(context context.Context, id string) (*analyzer.Analyzer, error) Delete(context context.Context, id string) error }
AnalyzerDAO is the interface to access database
type AnalyzerRuleDAO ¶
type AnalyzerRuleDAO interface { List(ctx context.Context, filter *ListFilter) ([]*analyzer.Rule, error) Save(ctx context.Context, ar *analyzer.Rule) error Get(ctx context.Context, id string) (*analyzer.Rule, error) Delete(ctx context.Context, id string) error Import(ctx context.Context, ars []*analyzer.Rule) error }
AnalyzerRuleDAO is the interface to access database
type ListFilter ¶
type ListFilter struct { Model models.ModelObject Indexes map[string]string Tags []string Query string Offset int Limit int Sorters []*Sorter }
ListFilter represents request for List operation
func (*ListFilter) AddIndex ¶
func (l *ListFilter) AddIndex(name, value string) *ListFilter
AddIndex adds new filter index
func (*ListFilter) From ¶
func (l *ListFilter) From(req *restful.Request) error
From collects info from http request
func (*ListFilter) Pagination ¶
func (l *ListFilter) Pagination(total int) models.Pagination
Pagination calculates pagination by offset, limit and total
type OrganizationDAO ¶
type OrganizationDAO interface { List(context context.Context, filter *ListFilter, accessFilter *models.OrgServiceAccessDataFilter) ([]*models.Organization, error) Save(context context.Context, organization *models.Organization, accessFilter *models.OrgServiceAccessDataFilter) error Get(context context.Context, id string) (*models.Organization, error) Delete(context context.Context, id string) error }
OrganizationDAO is the interface to access database
type ServiceDAO ¶
type ServiceDAO interface { List(context context.Context, filter *ListFilter, accessFilter *models.OrgServiceAccessDataFilter) ([]*models.Service, error) Save(context context.Context, service *models.Service, accessFilter *models.OrgServiceAccessDataFilter) error Get(context context.Context, id string) (*models.Service, error) Delete(context context.Context, id string) error }
ServiceDAO is the interface to access database
type SpecAnalysisDAO ¶
type SpecAnalysisDAO interface { List(context context.Context, filter *ListFilter) ([]*models.SpecAnalysis, error) Save(context context.Context, specAnalysis *models.SpecAnalysis) error Get(context context.Context, id string) (*models.SpecAnalysis, error) Delete(context context.Context, id string) error BatchDeleteBySpecID(context context.Context, specID string) error }
SpecAnalysisDAO is the interface to access database
type SpecDAO ¶
type SpecDAO interface { List(context context.Context, filter *ListFilter, withDoc bool) ([]*models.Spec, error) Save(context context.Context, spec *models.Spec) error Get(context context.Context, id string, withDoc bool) (*models.Spec, error) Delete(context context.Context, id string) error }
SpecDAO is the interface to access database
type SpecDiffDAO ¶
type SpecDiffDAO interface { List(context context.Context, filter *ListFilter) ([]*models.SpecDiff, error) Save(context context.Context, specDiff *models.SpecDiff) error Get(context context.Context, id string) (*models.SpecDiff, error) Delete(context context.Context, id string) error BatchDeleteBySpecID(context context.Context, specID string) error }
SpecDiffDAO is the interface to access database