From 4c16dafcf3e32db1ad8b9bda200f86c5e5fae397 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Fri, 28 Apr 2017 17:12:11 +0100 Subject: [PATCH] Add duration method to killable statements --- sql/ast.go | 3 ++- sql/kill.gen.go | 20 ++++++++++++++++++++ sql/kill.gen.go.tmpl | 4 ++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/sql/ast.go b/sql/ast.go index 3e0814d3..599c7100 100644 --- a/sql/ast.go +++ b/sql/ast.go @@ -45,6 +45,7 @@ type AuthableStatement interface { type KillableStatement interface { Begin() Cease() + Duration() time.Duration Timedout() <-chan struct{} } @@ -395,7 +396,7 @@ type DefineViewStatement struct { DB string `cork:"-" codec:"-"` Name *Ident `cork:"name" codec:"name"` Expr Fields `cork:"expr" codec:"expr"` - What Exprs `cork:"what" codec:"what"` + What Tables `cork:"what" codec:"what"` Cond Expr `cork:"cond" codec:"cond"` Group Groups `cork:"group" codec:"group"` } diff --git a/sql/kill.gen.go b/sql/kill.gen.go index 0dc8f0fb..bf71ffdb 100644 --- a/sql/kill.gen.go +++ b/sql/kill.gen.go @@ -48,6 +48,10 @@ func (s *SelectStatement) Cease() { } } +func (s *SelectStatement) Duration() time.Duration { + return s.Timeout +} + func (s *SelectStatement) Timedout() <-chan struct{} { if s.Timeout == 0 { return nil @@ -84,6 +88,10 @@ func (s *CreateStatement) Cease() { } } +func (s *CreateStatement) Duration() time.Duration { + return s.Timeout +} + func (s *CreateStatement) Timedout() <-chan struct{} { if s.Timeout == 0 { return nil @@ -120,6 +128,10 @@ func (s *UpdateStatement) Cease() { } } +func (s *UpdateStatement) Duration() time.Duration { + return s.Timeout +} + func (s *UpdateStatement) Timedout() <-chan struct{} { if s.Timeout == 0 { return nil @@ -156,6 +168,10 @@ func (s *DeleteStatement) Cease() { } } +func (s *DeleteStatement) Duration() time.Duration { + return s.Timeout +} + func (s *DeleteStatement) Timedout() <-chan struct{} { if s.Timeout == 0 { return nil @@ -192,6 +208,10 @@ func (s *RelateStatement) Cease() { } } +func (s *RelateStatement) Duration() time.Duration { + return s.Timeout +} + func (s *RelateStatement) Timedout() <-chan struct{} { if s.Timeout == 0 { return nil diff --git a/sql/kill.gen.go.tmpl b/sql/kill.gen.go.tmpl index 71a794ae..29f046df 100644 --- a/sql/kill.gen.go.tmpl +++ b/sql/kill.gen.go.tmpl @@ -46,6 +46,10 @@ func (s *{{$k.name}}Statement) Cease() { } } +func (s *{{$k.name}}Statement) Duration() time.Duration { + return s.Timeout +} + func (s *{{$k.name}}Statement) Timedout() <-chan struct{} { if s.Timeout == 0 { return nil