MCPcopy Index your code
hub / github.com/upper/db / LookupName

Method LookupName

adapter/postgresql/database.go:121–137  ·  view source on GitHub ↗
(sess sqladapter.Session)

Source from the content-addressed store, hash-verified

119}
120
121func (*database) LookupName(sess sqladapter.Session) (string, error) {
122 q := sess.SQL().
123 Select(db.Raw("CURRENT_DATABASE() AS name"))
124
125 iter := q.Iterator()
126 defer iter.Close()
127
128 if iter.Next() {
129 var name string
130 if err := iter.Scan(&name); err != nil {
131 return "", err
132 }
133 return name, nil
134 }
135
136 return "", iter.Err()
137}
138
139func (*database) TableExists(sess sqladapter.Session, name string) error {
140 q := sess.SQL().

Callers

nothing calls this directly

Calls 8

RawMethod · 0.80
SelectMethod · 0.65
SQLMethod · 0.65
IteratorMethod · 0.65
CloseMethod · 0.65
NextMethod · 0.65
ScanMethod · 0.65
ErrMethod · 0.65

Tested by

no test coverage detected