Path: blob/dev/pkg/js/libs/postgres/memo.postgres.go
2070 views
// Warning - This is generated code1package postgres23import (4"errors"5"fmt"67_ "github.com/projectdiscovery/nuclei/v3/pkg/js/utils/pgwrap"89utils "github.com/projectdiscovery/nuclei/v3/pkg/js/utils"1011"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/protocolstate"12)1314func memoizedisPostgres(executionId string, host string, port int) (bool, error) {15hash := "isPostgres" + ":" + fmt.Sprint(host) + ":" + fmt.Sprint(port)1617v, err, _ := protocolstate.Memoizer.Do(hash, func() (interface{}, error) {18return isPostgres(executionId, host, port)19})20if err != nil {21return false, err22}23if value, ok := v.(bool); ok {24return value, nil25}2627return false, errors.New("could not convert cached result")28}2930func memoizedexecuteQuery(executionId string, host string, port int, username string, password string, dbName string, query string) (*utils.SQLResult, error) {31hash := "executeQuery" + ":" + fmt.Sprint(host) + ":" + fmt.Sprint(port) + ":" + fmt.Sprint(username) + ":" + fmt.Sprint(password) + ":" + fmt.Sprint(dbName) + ":" + fmt.Sprint(query)3233v, err, _ := protocolstate.Memoizer.Do(hash, func() (interface{}, error) {34return executeQuery(executionId, host, port, username, password, dbName, query)35})36if err != nil {37return nil, err38}39if value, ok := v.(*utils.SQLResult); ok {40return value, nil41}4243return nil, errors.New("could not convert cached result")44}4546func memoizedconnect(executionId string, host string, port int, username string, password string, dbName string) (bool, error) {47hash := "connect" + ":" + fmt.Sprint(host) + ":" + fmt.Sprint(port) + ":" + fmt.Sprint(username) + ":" + fmt.Sprint(password) + ":" + fmt.Sprint(dbName)4849v, err, _ := protocolstate.Memoizer.Do(hash, func() (interface{}, error) {50return connect(executionId, host, port, username, password, dbName)51})52if err != nil {53return false, err54}55if value, ok := v.(bool); ok {56return value, nil57}5859return false, errors.New("could not convert cached result")60}616263