Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpectDBWithoutSequentialScan ¶
ExpectDBWithoutSequentialScan will annotate the given db connection and will - in case it detects a table scan - fail the running test.
func NewScanAlerterPlugin ¶
func NewScanAlerterPlugin(options AlertOptions, action actionFunc) *scanAlerter
func RegisterScanAlert ¶
func RegisterScanAlert(db *gorm.DB, options AlertOptions, action actionFunc)
Types ¶
type AlertOptions ¶
type AlertOptions struct { // Name is the name of the plugin. In case you are registering multiple // scanalerts, this must be unique for each one of them. Name string // Async will perform the detection within a go routing, instead of blocking. Async bool // QueryType contains the selection of which kind of query this should be scanning for. // This filter only applies for explicit methods from gorm's DB object // (e.g. Update, First, Find, Create, etc...) QueryTypes []QueryType // ErrorLogger provides a way to flush out internal errors from the plugin. // If not selected errors will be ignored. ErrorLogger func(args ...any) }
AlertOptions contains a group of options to be used by the scanalert plugin.
func DefaultAlertOptions ¶
func DefaultAlertOptions() AlertOptions
type QueryType ¶
type QueryType string
const ( // CreateQuery will scan for calls to `Create()`. CreateQuery QueryType = "create" // DeleteQuery will scan for calls to `Delete()` DeleteQuery QueryType = "delete" // RawQuery will scan for calls to `Raw()` or `Exec()` RawQuery QueryType = "raw" // SelectQuery will scan for calls to `Select()` SelectQuery QueryType = "query" // UpdateQuery will scan for calls to `Update()`. UpdateQuery QueryType = "update" )
Click to show internal directories.
Click to hide internal directories.