mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-30 19:09:34 -06:00
Merge pull request #8974 from dolthub/fulghum/notices
Add support for setting notices in the session
This commit is contained in:
@@ -50,7 +50,8 @@ var ErrSessionNotPersistable = errors.New("session is not persistable")
|
||||
// DoltSession is the sql.Session implementation used by dolt. It is accessible through a *sql.Context instance
|
||||
type DoltSession struct {
|
||||
sql.Session
|
||||
DoltgresSessObj any // This is used by Doltgres to persist objects in the session. This is not used by Dolt.
|
||||
DoltgresSessObj any // This is used by Doltgres to persist objects in the session. This is not used by Dolt.
|
||||
notices []any // This is used by Doltgres to store notices. This is not used by Dolt.
|
||||
username string
|
||||
email string
|
||||
dbStates map[string]*DatabaseSessionState
|
||||
@@ -326,6 +327,24 @@ func (d *DoltSession) ValidateSession(ctx *sql.Context) error {
|
||||
return d.validateErr
|
||||
}
|
||||
|
||||
// Notices returns the set of notices currently queued in this session. Notices are specific to Doltgres sessions
|
||||
// and are not used by Dolt sessions.
|
||||
func (d *DoltSession) Notices() []any {
|
||||
return d.notices
|
||||
}
|
||||
|
||||
// Notice adds a notice to the queue of the current notices in this session that have not been sent to the client yet.
|
||||
// Notices are specific to Doltgres sessions and are not used by Dolt sessions.
|
||||
func (d *DoltSession) Notice(notice any) {
|
||||
d.notices = append(d.notices, notice)
|
||||
}
|
||||
|
||||
// ClearNotices clears the queued notices in this session. Notices are specific to Doltgres sessions and are not
|
||||
// used by Dolt sessions.
|
||||
func (d *DoltSession) ClearNotices() {
|
||||
d.notices = nil
|
||||
}
|
||||
|
||||
// StartTransaction refreshes the state of this session and starts a new transaction.
|
||||
func (d *DoltSession) StartTransaction(ctx *sql.Context, tCharacteristic sql.TransactionCharacteristic) (sql.Transaction, error) {
|
||||
// TODO: this is only necessary to support filter-branch, which needs to set a root directly and not have the
|
||||
|
||||
Reference in New Issue
Block a user