postgres

package
v0.0.0-...-c26c883 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetScanResults = `
        SELECT response FROM scan_results
        WHERE input_type = $1 AND request = $2
        FOR UPDATE
    `
	UpdateScanResults = `
        UPDATE scan_results
        SET access_count = access_count + 1
        WHERE input_type = $1 AND request = $2
    `

	SaveScanResults = `` /* 311-byte string literal not displayed */

	SaveUserScanStats = `` /* 305-byte string literal not displayed */

)
View Source
const (
	PostgresMaxRecords = 10000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Postgres

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

func New

func New(db *sql.DB, logger *slog.Logger) *Postgres

func (*Postgres) GetSavedResponse

func (p *Postgres) GetSavedResponse(ctx context.Context, inputType, requestParam string) (string, error)

GetSavedResponse берем сохраненный ответ из PostgreSQL и обновляем access_count

func (*Postgres) SaveResponse

func (p *Postgres) SaveResponse(ctx context.Context, responseJson, inputType, requestParam string) error

func (*Postgres) SaveUserResponse

func (p *Postgres) SaveUserResponse(ctx context.Context, userID int, zone, inputType, requestParam string) error

Jump to

Keyboard shortcuts

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