Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/pkg/js/libs/mssql/memo.mssql.go
2070 views
1
// Warning - This is generated code
2
package mssql
3
4
import (
5
"errors"
6
"fmt"
7
8
_ "github.com/microsoft/go-mssqldb"
9
10
"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/protocolstate"
11
)
12
13
func memoizedconnect(executionId string, host string, port int, username string, password string, dbName string) (bool, error) {
14
hash := "connect" + ":" + fmt.Sprint(host) + ":" + fmt.Sprint(port) + ":" + fmt.Sprint(username) + ":" + fmt.Sprint(password) + ":" + fmt.Sprint(dbName)
15
16
v, err, _ := protocolstate.Memoizer.Do(hash, func() (interface{}, error) {
17
return connect(executionId, host, port, username, password, dbName)
18
})
19
if err != nil {
20
return false, err
21
}
22
if value, ok := v.(bool); ok {
23
return value, nil
24
}
25
26
return false, errors.New("could not convert cached result")
27
}
28
29
func memoizedisMssql(executionId string, host string, port int) (bool, error) {
30
hash := "isMssql" + ":" + fmt.Sprint(host) + ":" + fmt.Sprint(port)
31
32
v, err, _ := protocolstate.Memoizer.Do(hash, func() (interface{}, error) {
33
return isMssql(executionId, host, port)
34
})
35
if err != nil {
36
return false, err
37
}
38
if value, ok := v.(bool); ok {
39
return value, nil
40
}
41
42
return false, errors.New("could not convert cached result")
43
}
44
45