storage

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidRepositoryType indicates that the specified repository type is not valid.
	ErrInvalidRepositoryType = errors.New("Invalid repository type")
	// ErrInvalidReportData indicates that given report data is not valid.
	ErrInvalidReportData = errors.New("Invalid report data")
	// ErrReportNotFound indicates that the specified report was not found.
	ErrReportNotFound = errors.New("Report not found")
)
View Source
var ErrSyncFail = errors.New("storage: failed to synchronize data after insert")

ErrSyncFail occurs during insert when the record could not be retrieved in order to populate default value information. This usually happens when LastInsertId fails or there was a primary key configuration that was not resolvable.

View Source
var LiveReportColumns = struct {
	ID             string
	EmailSubject   string
	EmailBody      string
	TeamID         string
	DateTo         string
	DateFrom       string
	DeliveredTo    string
	UpdateStatusAt string
	Status         string
	CreatedAt      string
	UpdatedAt      string
}{
	ID:             "id",
	EmailSubject:   "email_subject",
	EmailBody:      "email_body",
	TeamID:         "team_id",
	DateTo:         "date_to",
	DateFrom:       "date_from",
	DeliveredTo:    "delivered_to",
	UpdateStatusAt: "update_status_at",
	Status:         "status",
	CreatedAt:      "created_at",
	UpdatedAt:      "updated_at",
}
View Source
var LiveReportRels = struct {
}{}

LiveReportRels is where relationship names are stored.

View Source
var LiveReportWhere = struct {
	ID             whereHelperstring
	EmailSubject   whereHelperstring
	EmailBody      whereHelperstring
	TeamID         whereHelperstring
	DateTo         whereHelperstring
	DateFrom       whereHelperstring
	DeliveredTo    whereHelperstring
	UpdateStatusAt whereHelpertime_Time
	Status         whereHelperstring
	CreatedAt      whereHelpertime_Time
	UpdatedAt      whereHelpertime_Time
}{
	ID:             whereHelperstring{/* contains filtered or unexported fields */},
	EmailSubject:   whereHelperstring{/* contains filtered or unexported fields */},
	EmailBody:      whereHelperstring{/* contains filtered or unexported fields */},
	TeamID:         whereHelperstring{/* contains filtered or unexported fields */},
	DateTo:         whereHelperstring{/* contains filtered or unexported fields */},
	DateFrom:       whereHelperstring{/* contains filtered or unexported fields */},
	DeliveredTo:    whereHelperstring{/* contains filtered or unexported fields */},
	UpdateStatusAt: whereHelpertime_Time{/* contains filtered or unexported fields */},
	Status:         whereHelperstring{/* contains filtered or unexported fields */},
	CreatedAt:      whereHelpertime_Time{/* contains filtered or unexported fields */},
	UpdatedAt:      whereHelpertime_Time{/* contains filtered or unexported fields */},
}
View Source
var ScanReportColumns = struct {
	ID             string
	ScanID         string
	Report         string
	ReportJSON     string
	EmailSubject   string
	EmailBody      string
	DeliveredTo    string
	UpdateStatusAt string
	Status         string
	CreatedAt      string
	UpdatedAt      string
	ProgramName    string
	Risk           string
}{
	ID:             "id",
	ScanID:         "scan_id",
	Report:         "report",
	ReportJSON:     "report_json",
	EmailSubject:   "email_subject",
	EmailBody:      "email_body",
	DeliveredTo:    "delivered_to",
	UpdateStatusAt: "update_status_at",
	Status:         "status",
	CreatedAt:      "created_at",
	UpdatedAt:      "updated_at",
	ProgramName:    "program_name",
	Risk:           "risk",
}
View Source
var ScanReportRels = struct {
}{}

ScanReportRels is where relationship names are stored.

View Source
var ScanReportWhere = struct {
	ID             whereHelperstring
	ScanID         whereHelperstring
	Report         whereHelperstring
	ReportJSON     whereHelperstring
	EmailSubject   whereHelperstring
	EmailBody      whereHelperstring
	DeliveredTo    whereHelperstring
	UpdateStatusAt whereHelpertime_Time
	Status         whereHelperstring
	CreatedAt      whereHelpertime_Time
	UpdatedAt      whereHelpertime_Time
	ProgramName    whereHelperstring
	Risk           whereHelperint
}{
	ID:             whereHelperstring{/* contains filtered or unexported fields */},
	ScanID:         whereHelperstring{/* contains filtered or unexported fields */},
	Report:         whereHelperstring{/* contains filtered or unexported fields */},
	ReportJSON:     whereHelperstring{/* contains filtered or unexported fields */},
	EmailSubject:   whereHelperstring{/* contains filtered or unexported fields */},
	EmailBody:      whereHelperstring{/* contains filtered or unexported fields */},
	DeliveredTo:    whereHelperstring{/* contains filtered or unexported fields */},
	UpdateStatusAt: whereHelpertime_Time{/* contains filtered or unexported fields */},
	Status:         whereHelperstring{/* contains filtered or unexported fields */},
	CreatedAt:      whereHelpertime_Time{/* contains filtered or unexported fields */},
	UpdatedAt:      whereHelpertime_Time{/* contains filtered or unexported fields */},
	ProgramName:    whereHelperstring{/* contains filtered or unexported fields */},
	Risk:           whereHelperint{/* contains filtered or unexported fields */},
}
View Source
var TableNames = struct {
	LiveReports string
	ScanReports string
}{
	LiveReports: "live_reports",
	ScanReports: "scan_reports",
}

Functions

func LiveReportExists

func LiveReportExists(ctx context.Context, exec boil.ContextExecutor, iD string) (bool, error)

LiveReportExists checks if the LiveReport row exists.

func LiveReportExistsG

func LiveReportExistsG(ctx context.Context, iD string) (bool, error)

LiveReportExistsG checks if the LiveReport row exists.

func LiveReports

func LiveReports(mods ...qm.QueryMod) liveReportQuery

LiveReports retrieves all the records using an executor.

func NewQuery

func NewQuery(mods ...qm.QueryMod) *queries.Query

NewQuery initializes a new Query using the passed in QueryMods

func ScanReportExists

func ScanReportExists(ctx context.Context, exec boil.ContextExecutor, iD string) (bool, error)

ScanReportExists checks if the ScanReport row exists.

func ScanReportExistsG

func ScanReportExistsG(ctx context.Context, iD string) (bool, error)

ScanReportExistsG checks if the ScanReport row exists.

func ScanReports

func ScanReports(mods ...qm.QueryMod) scanReportQuery

ScanReports retrieves all the records using an executor.

Types

type LiveReport

type LiveReport struct {
	ID             string    `boil:"id" json:"id" toml:"id" yaml:"id"`
	EmailSubject   string    `boil:"email_subject" json:"email_subject" toml:"email_subject" yaml:"email_subject"`
	EmailBody      string    `boil:"email_body" json:"email_body" toml:"email_body" yaml:"email_body"`
	TeamID         string    `boil:"team_id" json:"team_id" toml:"team_id" yaml:"team_id"`
	DateTo         string    `boil:"date_to" json:"date_to" toml:"date_to" yaml:"date_to"`
	DateFrom       string    `boil:"date_from" json:"date_from" toml:"date_from" yaml:"date_from"`
	DeliveredTo    string    `boil:"delivered_to" json:"delivered_to" toml:"delivered_to" yaml:"delivered_to"`
	UpdateStatusAt time.Time `boil:"update_status_at" json:"update_status_at" toml:"update_status_at" yaml:"update_status_at"`
	Status         string    `boil:"status" json:"status" toml:"status" yaml:"status"`
	CreatedAt      time.Time `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`
	UpdatedAt      time.Time `boil:"updated_at" json:"updated_at" toml:"updated_at" yaml:"updated_at"`

	R *liveReportR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L liveReportL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

LiveReport is an object representing the database table.

func FindLiveReport

func FindLiveReport(ctx context.Context, exec boil.ContextExecutor, iD string, selectCols ...string) (*LiveReport, error)

FindLiveReport retrieves a single record by ID with an executor. If selectCols is empty Find will return all columns.

func FindLiveReportG

func FindLiveReportG(ctx context.Context, iD string, selectCols ...string) (*LiveReport, error)

FindLiveReportG retrieves a single record by ID.

func (*LiveReport) Delete

func (o *LiveReport) Delete(ctx context.Context, exec boil.ContextExecutor) (int64, error)

Delete deletes a single LiveReport record with an executor. Delete will match against the primary key column to find the record to delete.

func (*LiveReport) DeleteG

func (o *LiveReport) DeleteG(ctx context.Context) (int64, error)

DeleteG deletes a single LiveReport record. DeleteG will match against the primary key column to find the record to delete.

func (*LiveReport) Insert

func (o *LiveReport) Insert(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) error

Insert a single record using an executor. See boil.Columns.InsertColumnSet documentation to understand column list inference for inserts.

func (*LiveReport) InsertG

func (o *LiveReport) InsertG(ctx context.Context, columns boil.Columns) error

InsertG a single record. See Insert for whitelist behavior description.

func (*LiveReport) Reload

func (o *LiveReport) Reload(ctx context.Context, exec boil.ContextExecutor) error

Reload refetches the object from the database using the primary keys with an executor.

func (*LiveReport) ReloadG

func (o *LiveReport) ReloadG(ctx context.Context) error

ReloadG refetches the object from the database using the primary keys.

func (*LiveReport) Update

func (o *LiveReport) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error)

Update uses an executor to update the LiveReport. See boil.Columns.UpdateColumnSet documentation to understand column list inference for updates. Update does not automatically update the record in case of default values. Use .Reload() to refresh the records.

func (*LiveReport) UpdateG

func (o *LiveReport) UpdateG(ctx context.Context, columns boil.Columns) (int64, error)

UpdateG a single LiveReport record using the global executor. See Update for more documentation.

func (*LiveReport) Upsert

func (o *LiveReport) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error

Upsert attempts an insert using an executor, and does an update or ignore on conflict. See boil.Columns documentation for how to properly use updateColumns and insertColumns.

func (*LiveReport) UpsertG

func (o *LiveReport) UpsertG(ctx context.Context, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error

UpsertG attempts an insert, and does an update or ignore on conflict.

type LiveReportSlice

type LiveReportSlice []*LiveReport

LiveReportSlice is an alias for a slice of pointers to LiveReport. This should generally be used opposed to []LiveReport.

func (LiveReportSlice) DeleteAll

func (o LiveReportSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error)

DeleteAll deletes all rows in the slice, using an executor.

func (LiveReportSlice) DeleteAllG

func (o LiveReportSlice) DeleteAllG(ctx context.Context) (int64, error)

DeleteAllG deletes all rows in the slice.

func (*LiveReportSlice) ReloadAll

func (o *LiveReportSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error

ReloadAll refetches every row with matching primary key column values and overwrites the original object slice with the newly updated slice.

func (*LiveReportSlice) ReloadAllG

func (o *LiveReportSlice) ReloadAllG(ctx context.Context) error

ReloadAllG refetches every row with matching primary key column values and overwrites the original object slice with the newly updated slice.

func (LiveReportSlice) UpdateAll

func (o LiveReportSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error)

UpdateAll updates all rows with the specified column values, using an executor.

func (LiveReportSlice) UpdateAllG

func (o LiveReportSlice) UpdateAllG(ctx context.Context, cols M) (int64, error)

UpdateAllG updates all rows with the specified column values.

type LiveReportsRepository

type LiveReportsRepository struct {
	// contains filtered or unexported fields
}

func (*LiveReportsRepository) GetReport

func (r *LiveReportsRepository) GetReport(ctx context.Context, reportID string) (model.Report, error)

func (*LiveReportsRepository) GetReportByTeamAndDateRange

func (r *LiveReportsRepository) GetReportByTeamAndDateRange(ctx context.Context, teamID string, dateFrom string, dateTo string) (*model.LiveReport, error)

func (*LiveReportsRepository) Insert

func (r *LiveReportsRepository) Insert(ctx context.Context, report *model.LiveReport) error

func (*LiveReportsRepository) SaveReport

func (r *LiveReportsRepository) SaveReport(ctx context.Context, report model.Report) error

func (*LiveReportsRepository) Update

func (r *LiveReportsRepository) Update(ctx context.Context, report *model.LiveReport) error

type M

type M map[string]interface{}

M type is for providing columns and column values to UpdateAll.

type ReportsRepository

type ReportsRepository interface {
	GetReport(ctx context.Context, reportID string) (model.Report, error)
	SaveReport(ctx context.Context, report model.Report) error
}

ReportsRepository represents the abstraction for a generic report repository.

func NewReportsRepository

func NewReportsRepository(typ string, db *sql.DB) (ReportsRepository, error)

NewReportsRepository builds and returns a new ReportsRepository for the specified type.

type ScanReport

type ScanReport struct {
	ID             string    `boil:"id" json:"id" toml:"id" yaml:"id"`
	ScanID         string    `boil:"scan_id" json:"scan_id" toml:"scan_id" yaml:"scan_id"`
	Report         string    `boil:"report" json:"report" toml:"report" yaml:"report"`
	ReportJSON     string    `boil:"report_json" json:"report_json" toml:"report_json" yaml:"report_json"`
	EmailSubject   string    `boil:"email_subject" json:"email_subject" toml:"email_subject" yaml:"email_subject"`
	EmailBody      string    `boil:"email_body" json:"email_body" toml:"email_body" yaml:"email_body"`
	DeliveredTo    string    `boil:"delivered_to" json:"delivered_to" toml:"delivered_to" yaml:"delivered_to"`
	UpdateStatusAt time.Time `boil:"update_status_at" json:"update_status_at" toml:"update_status_at" yaml:"update_status_at"`
	Status         string    `boil:"status" json:"status" toml:"status" yaml:"status"`
	CreatedAt      time.Time `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`
	UpdatedAt      time.Time `boil:"updated_at" json:"updated_at" toml:"updated_at" yaml:"updated_at"`
	ProgramName    string    `boil:"program_name" json:"program_name" toml:"program_name" yaml:"program_name"`
	Risk           int       `boil:"risk" json:"risk" toml:"risk" yaml:"risk"`

	R *scanReportR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L scanReportL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

ScanReport is an object representing the database table.

func FindScanReport

func FindScanReport(ctx context.Context, exec boil.ContextExecutor, iD string, selectCols ...string) (*ScanReport, error)

FindScanReport retrieves a single record by ID with an executor. If selectCols is empty Find will return all columns.

func FindScanReportG

func FindScanReportG(ctx context.Context, iD string, selectCols ...string) (*ScanReport, error)

FindScanReportG retrieves a single record by ID.

func (*ScanReport) Delete

func (o *ScanReport) Delete(ctx context.Context, exec boil.ContextExecutor) (int64, error)

Delete deletes a single ScanReport record with an executor. Delete will match against the primary key column to find the record to delete.

func (*ScanReport) DeleteG

func (o *ScanReport) DeleteG(ctx context.Context) (int64, error)

DeleteG deletes a single ScanReport record. DeleteG will match against the primary key column to find the record to delete.

func (*ScanReport) Insert

func (o *ScanReport) Insert(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) error

Insert a single record using an executor. See boil.Columns.InsertColumnSet documentation to understand column list inference for inserts.

func (*ScanReport) InsertG

func (o *ScanReport) InsertG(ctx context.Context, columns boil.Columns) error

InsertG a single record. See Insert for whitelist behavior description.

func (*ScanReport) Reload

func (o *ScanReport) Reload(ctx context.Context, exec boil.ContextExecutor) error

Reload refetches the object from the database using the primary keys with an executor.

func (*ScanReport) ReloadG

func (o *ScanReport) ReloadG(ctx context.Context) error

ReloadG refetches the object from the database using the primary keys.

func (*ScanReport) Update

func (o *ScanReport) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error)

Update uses an executor to update the ScanReport. See boil.Columns.UpdateColumnSet documentation to understand column list inference for updates. Update does not automatically update the record in case of default values. Use .Reload() to refresh the records.

func (*ScanReport) UpdateG

func (o *ScanReport) UpdateG(ctx context.Context, columns boil.Columns) (int64, error)

UpdateG a single ScanReport record using the global executor. See Update for more documentation.

func (*ScanReport) Upsert

func (o *ScanReport) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error

Upsert attempts an insert using an executor, and does an update or ignore on conflict. See boil.Columns documentation for how to properly use updateColumns and insertColumns.

func (*ScanReport) UpsertG

func (o *ScanReport) UpsertG(ctx context.Context, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error

UpsertG attempts an insert, and does an update or ignore on conflict.

type ScanReportSlice

type ScanReportSlice []*ScanReport

ScanReportSlice is an alias for a slice of pointers to ScanReport. This should generally be used opposed to []ScanReport.

func (ScanReportSlice) DeleteAll

func (o ScanReportSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error)

DeleteAll deletes all rows in the slice, using an executor.

func (ScanReportSlice) DeleteAllG

func (o ScanReportSlice) DeleteAllG(ctx context.Context) (int64, error)

DeleteAllG deletes all rows in the slice.

func (*ScanReportSlice) ReloadAll

func (o *ScanReportSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error

ReloadAll refetches every row with matching primary key column values and overwrites the original object slice with the newly updated slice.

func (*ScanReportSlice) ReloadAllG

func (o *ScanReportSlice) ReloadAllG(ctx context.Context) error

ReloadAllG refetches every row with matching primary key column values and overwrites the original object slice with the newly updated slice.

func (ScanReportSlice) UpdateAll

func (o ScanReportSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error)

UpdateAll updates all rows with the specified column values, using an executor.

func (ScanReportSlice) UpdateAllG

func (o ScanReportSlice) UpdateAllG(ctx context.Context, cols M) (int64, error)

UpdateAllG updates all rows with the specified column values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL