Update Statement ASTs
This commit is contained in:
parent
1fc814bb43
commit
3bbfa7919a
1 changed files with 191 additions and 196 deletions
387
sql/ast.go
387
sql/ast.go
|
@ -14,6 +14,12 @@
|
||||||
|
|
||||||
package sql
|
package sql
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strconv"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Queries
|
// Queries
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
@ -43,132 +49,107 @@ type UseStatement struct {
|
||||||
// Trans
|
// Trans
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
|
// UseStatement represents a SQL BEGIN TRANSACTION statement.
|
||||||
type BeginStatement struct{}
|
type BeginStatement struct{}
|
||||||
|
|
||||||
|
// UseStatement represents a SQL CANCEL TRANSACTION statement.
|
||||||
type CancelStatement struct{}
|
type CancelStatement struct{}
|
||||||
|
|
||||||
|
// UseStatement represents a SQL COMMIT TRANSACTION statement.
|
||||||
type CommitStatement struct{}
|
type CommitStatement struct{}
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Normal
|
// Normal
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
// ActionStatement represents a SQL ACTION statement.
|
|
||||||
type ActionStatement struct {
|
|
||||||
EX bool // Explain
|
|
||||||
KV string // Bucket
|
|
||||||
NS string // Namespace
|
|
||||||
DB string // Database
|
|
||||||
Expr []*Field // Which fields
|
|
||||||
What []Expr // What to select
|
|
||||||
Cond []Expr // Select conditions
|
|
||||||
Group []*Group // Group by
|
|
||||||
Order []*Order // Order by
|
|
||||||
Limit Expr // Limit by
|
|
||||||
Start Expr // Start at
|
|
||||||
Version Expr // Version
|
|
||||||
}
|
|
||||||
|
|
||||||
// SelectStatement represents a SQL SELECT statement.
|
// SelectStatement represents a SQL SELECT statement.
|
||||||
type SelectStatement struct {
|
type SelectStatement struct {
|
||||||
EX bool // Explain
|
EX bool `codec:"-"`
|
||||||
KV string // Bucket
|
KV string `codec:"-"`
|
||||||
NS string // Namespace
|
NS string `codec:"-"`
|
||||||
DB string // Database
|
DB string `codec:"-"`
|
||||||
Expr []*Field // Which fields
|
Expr []*Field `codec:"-"`
|
||||||
What []Expr // What to select
|
What []Expr `codec:"-"`
|
||||||
Cond []Expr // Select conditions
|
Cond []Expr `codec:"-"`
|
||||||
Group []*Group // Group by
|
Group []*Group `codec:"-"`
|
||||||
Order []*Order // Order by
|
Order []*Order `codec:"-"`
|
||||||
Limit Expr // Limit by
|
Limit Expr `codec:"-"`
|
||||||
Start Expr // Start at
|
Start Expr `codec:"-"`
|
||||||
Version Expr // Version
|
Version Expr `codec:"-"`
|
||||||
Echo Token // What to return
|
Echo Token `codec:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateStatement represents a SQL CREATE statement.
|
// CreateStatement represents a SQL CREATE statement.
|
||||||
//
|
|
||||||
// CREATE person SET column = 'value' RETURN ID
|
|
||||||
type CreateStatement struct {
|
type CreateStatement struct {
|
||||||
EX bool // Explain
|
EX bool `codec:"-"`
|
||||||
KV string // Bucket
|
KV string `codec:"-"`
|
||||||
NS string // Namespace
|
NS string `codec:"-"`
|
||||||
DB string // Database
|
DB string `codec:"-"`
|
||||||
What []Expr // What to create
|
What []Expr `codec:"-"`
|
||||||
Data []Expr // Create data
|
Data []Expr `codec:"-"`
|
||||||
Echo Token // What to return
|
Echo Token `codec:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateStatement represents a SQL UPDATE statement.
|
// UpdateStatement represents a SQL UPDATE statement.
|
||||||
//
|
|
||||||
// UPDATE person SET column = 'value' WHERE age < 18 RETURN ID
|
|
||||||
type UpdateStatement struct {
|
type UpdateStatement struct {
|
||||||
EX bool // Explain
|
EX bool `codec:"-"`
|
||||||
KV string // Bucket
|
KV string `codec:"-"`
|
||||||
NS string // Namespace
|
NS string `codec:"-"`
|
||||||
DB string // Database
|
DB string `codec:"-"`
|
||||||
What []Expr // What to update
|
What []Expr `codec:"-"`
|
||||||
Data []Expr // Update data
|
Data []Expr `codec:"-"`
|
||||||
Cond []Expr // Update conditions
|
Cond []Expr `codec:"-"`
|
||||||
Echo Token // What to return
|
Echo Token `codec:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ModifyStatement represents a SQL UPDATE statement.
|
// ModifyStatement represents a SQL MODIFY statement.
|
||||||
//
|
|
||||||
// MODIFY @person:123 WITH {} RETURN ID
|
|
||||||
type ModifyStatement struct {
|
type ModifyStatement struct {
|
||||||
EX bool // Explain
|
EX bool `codec:"-"`
|
||||||
KV string // Bucket
|
KV string `codec:"-"`
|
||||||
NS string // Namespace
|
NS string `codec:"-"`
|
||||||
DB string // Database
|
DB string `codec:"-"`
|
||||||
What []Expr // What to modify
|
What []Expr `codec:"-"`
|
||||||
Diff []Expr // Diff object
|
Diff []Expr `codec:"-"`
|
||||||
Cond []Expr // Update conditions
|
Cond []Expr `codec:"-"`
|
||||||
Echo Token // What to return
|
Echo Token `codec:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteStatement represents a SQL DELETE statement.
|
// DeleteStatement represents a SQL DELETE statement.
|
||||||
//
|
|
||||||
// DELETE FROM person WHERE age < 18 RETURN ID
|
|
||||||
type DeleteStatement struct {
|
type DeleteStatement struct {
|
||||||
EX bool // Explain
|
EX bool `codec:"-"`
|
||||||
KV string // Bucket
|
KV string `codec:"-"`
|
||||||
NS string // Namespace
|
NS string `codec:"-"`
|
||||||
DB string // Database
|
DB string `codec:"-"`
|
||||||
Hard bool // Expunge
|
Hard bool `codec:"-"`
|
||||||
What []Expr // What to delete
|
What []Expr `codec:"-"`
|
||||||
Cond []Expr // Delete conditions
|
Cond []Expr `codec:"-"`
|
||||||
Echo Token // What to return
|
Echo Token `codec:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// RelateStatement represents a SQL RELATE statement.
|
// RelateStatement represents a SQL RELATE statement.
|
||||||
//
|
|
||||||
// RELATE friend FROM @person:123 TO @person:456 SET column = 'value' RETURN ID
|
|
||||||
type RelateStatement struct {
|
type RelateStatement struct {
|
||||||
EX bool // Explain
|
EX bool `codec:"-"`
|
||||||
KV string // Bucket
|
KV string `codec:"-"`
|
||||||
NS string // Namespace
|
NS string `codec:"-"`
|
||||||
DB string // Database
|
DB string `codec:"-"`
|
||||||
Type []Expr
|
Type []Expr `codec:"-"`
|
||||||
From []Expr
|
From []Expr `codec:"-"`
|
||||||
To []Expr
|
To []Expr `codec:"-"`
|
||||||
Data []Expr
|
Data []Expr `codec:"-"`
|
||||||
Echo Token // What to return
|
Echo Token `codec:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// RecordStatement represents a SQL CREATE EVENT statement.
|
// RecordStatement represents a SQL CREATE EVENT statement.
|
||||||
//
|
|
||||||
// RECORD login ON @person:123 AT 2016-01-29T22:42:56.478Z SET column = true
|
|
||||||
type RecordStatement struct {
|
type RecordStatement struct {
|
||||||
EX bool // Explain
|
EX bool `codec:"-"`
|
||||||
KV string // Bucket
|
KV string `codec:"-"`
|
||||||
NS string // Namespace
|
NS string `codec:"-"`
|
||||||
DB string // Database
|
DB string `codec:"-"`
|
||||||
Type []Expr
|
Type []Expr `codec:"-"`
|
||||||
On []Expr
|
On []Expr `codec:"-"`
|
||||||
At Expr
|
At Expr `codec:"-"`
|
||||||
Data []Expr
|
Data []Expr `codec:"-"`
|
||||||
Echo Token // What to return
|
Echo Token `codec:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
@ -176,29 +157,25 @@ type RecordStatement struct {
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
// DefineRulesStatement represents an SQL DEFINE RULES statement.
|
// DefineRulesStatement represents an SQL DEFINE RULES statement.
|
||||||
//
|
|
||||||
// DEFINE RULES person
|
|
||||||
type DefineRulesStatement struct {
|
type DefineRulesStatement struct {
|
||||||
EX bool `json:"-" msgpack:"-"` // Explain
|
EX bool `codec:"-"`
|
||||||
KV string `json:"-" msgpack:"-"` // Bucket
|
KV string `codec:"-"`
|
||||||
NS string `json:"-" msgpack:"-"` // Namespace
|
NS string `codec:"-"`
|
||||||
DB string `json:"-" msgpack:"-"` // Database
|
DB string `codec:"-"`
|
||||||
What []string `json:"-" msgpack:"-"` // Table names
|
What []string `codec:"-"`
|
||||||
When []string `json:"-" msgpack:"-"` // Action names
|
When []string `codec:"-"`
|
||||||
Rule string `json:"rule" msgpack:"rule"` // Rule behaviour
|
Rule string `codec:"rule"`
|
||||||
Code string `json:"code" msgpack:"code"` // Rule custom code
|
Code string `codec:"code"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveRulesStatement represents an SQL REMOVE RULES statement.
|
// RemoveRulesStatement represents an SQL REMOVE RULES statement.
|
||||||
//
|
|
||||||
// REMOVE RULES person
|
|
||||||
type RemoveRulesStatement struct {
|
type RemoveRulesStatement struct {
|
||||||
EX bool `json:"-" msgpack:"-"` // Explain
|
EX bool `codec:"-"`
|
||||||
KV string `json:"-" msgpack:"-"` // Bucket
|
KV string `codec:"-"`
|
||||||
NS string `json:"-" msgpack:"-"` // Namespace
|
NS string `codec:"-"`
|
||||||
DB string `json:"-" msgpack:"-"` // Database
|
DB string `codec:"-"`
|
||||||
What []string `json:"-" msgpack:"-"` // Table names
|
What []string `codec:"-"`
|
||||||
When []string `json:"-" msgpack:"-"` // Action names
|
When []string `codec:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
@ -206,25 +183,21 @@ type RemoveRulesStatement struct {
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
// DefineTableStatement represents an SQL DEFINE TABLE statement.
|
// DefineTableStatement represents an SQL DEFINE TABLE statement.
|
||||||
//
|
|
||||||
// DEFINE TABLE person
|
|
||||||
type DefineTableStatement struct {
|
type DefineTableStatement struct {
|
||||||
EX bool `json:"-" msgpack:"-"` // Explain
|
EX bool `codec:"-"`
|
||||||
KV string `json:"-" msgpack:"-"` // Bucket
|
KV string `codec:"-"`
|
||||||
NS string `json:"-" msgpack:"-"` // Namespace
|
NS string `codec:"-"`
|
||||||
DB string `json:"-" msgpack:"-"` // Database
|
DB string `codec:"-"`
|
||||||
What []string `json:"-" msgpack:"-"` // Table names
|
What []string `codec:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveTableStatement represents an SQL REMOVE TABLE statement.
|
// RemoveTableStatement represents an SQL REMOVE TABLE statement.
|
||||||
//
|
|
||||||
// REMOVE TABLE person
|
|
||||||
type RemoveTableStatement struct {
|
type RemoveTableStatement struct {
|
||||||
EX bool `json:"-" msgpack:"-"` // Explain
|
EX bool `codec:"-"`
|
||||||
KV string `json:"-" msgpack:"-"` // Bucket
|
KV string `codec:"-"`
|
||||||
NS string `json:"-" msgpack:"-"` // Namespace
|
NS string `codec:"-"`
|
||||||
DB string `json:"-" msgpack:"-"` // Database
|
DB string `codec:"-"`
|
||||||
What []string `json:"-" msgpack:"-"` // Table names
|
What []string `codec:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
@ -232,40 +205,34 @@ type RemoveTableStatement struct {
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
// DefineFieldStatement represents an SQL DEFINE INDEX statement.
|
// DefineFieldStatement represents an SQL DEFINE INDEX statement.
|
||||||
//
|
|
||||||
// DEFINE FIELD name ON person TYPE string CODE {}
|
|
||||||
// DEFINE FIELD name ON person TYPE number MIN 0 MAX 5 DEFAULT 0
|
|
||||||
// DEFINE FIELD name ON person TYPE custom ENUM [0,1,2,3,4,5] DEFAULT 0
|
|
||||||
type DefineFieldStatement struct {
|
type DefineFieldStatement struct {
|
||||||
EX bool `json:"-" msgpack:"-"` // Explain
|
EX bool `codec:"-"`
|
||||||
KV string `json:"-" msgpack:"-"` // Bucket
|
KV string `codec:"-"`
|
||||||
NS string `json:"-" msgpack:"-"` // Namespace
|
NS string `codec:"-"`
|
||||||
DB string `json:"-" msgpack:"-"` // Database
|
DB string `codec:"-"`
|
||||||
Name string `json:"name" msgpack:"name"` // Field name
|
Name string `codec:"name"`
|
||||||
What []string `json:"-" msgpack:"-"` // Table names
|
What []string `codec:"-"`
|
||||||
Type string `json:"type" msgpack:"type"` // Field type
|
Type string `codec:"type"`
|
||||||
Enum []interface{} `json:"enum" msgpack:"enum"` // Custom options
|
Enum []interface{} `codec:"enum"`
|
||||||
Code string `json:"code" msgpack:"code"` // Field code
|
Code string `codec:"code"`
|
||||||
Min float64 `json:"min" msgpack:"min"` // Minimum value / length
|
Min float64 `codec:"min"`
|
||||||
Max float64 `json:"max" msgpack:"max"` // Maximum value / length
|
Max float64 `codec:"max"`
|
||||||
Match string `json:"match" msgpack:"match"` // Regex value
|
Match string `codec:"match"`
|
||||||
Default interface{} `json:"default" msgpack:"default"` // Default value
|
Default interface{} `codec:"default"`
|
||||||
Notnull bool `json:"notnull" msgpack:"notnull"` // Notnull - can not be NULL?
|
Notnull bool `codec:"notnull"`
|
||||||
Readonly bool `json:"readonly" msgpack:"readonly"` // Readonly - can not be changed?
|
Readonly bool `codec:"readonly"`
|
||||||
Mandatory bool `json:"mandatory" msgpack:"mandatory"` // Mandatory - can not be VOID?
|
Mandatory bool `codec:"mandatory"`
|
||||||
Validate bool `json:"validate" msgpack:"validate"` // Validate - can not be INCORRECT?
|
Validate bool `codec:"validate"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveFieldStatement represents an SQL REMOVE INDEX statement.
|
// RemoveFieldStatement represents an SQL REMOVE INDEX statement.
|
||||||
//
|
|
||||||
// REMOVE FIELD name ON person
|
|
||||||
type RemoveFieldStatement struct {
|
type RemoveFieldStatement struct {
|
||||||
EX bool `json:"-" msgpack:"-"` // Explain
|
EX bool `codec:"-"`
|
||||||
KV string `json:"-" msgpack:"-"` // Bucket
|
KV string `codec:"-"`
|
||||||
NS string `json:"-" msgpack:"-"` // Namespace
|
NS string `codec:"-"`
|
||||||
DB string `json:"-" msgpack:"-"` // Database
|
DB string `codec:"-"`
|
||||||
Name string `json:"-" msgpack:"-"` // Field name
|
Name string `codec:"-"`
|
||||||
What []string `json:"-" msgpack:"-"` // Table names
|
What []string `codec:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
@ -273,42 +240,25 @@ type RemoveFieldStatement struct {
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
// DefineIndexStatement represents an SQL DEFINE INDEX statement.
|
// DefineIndexStatement represents an SQL DEFINE INDEX statement.
|
||||||
//
|
|
||||||
// DEFINE INDEX name ON person COLUMNS (account, age) UNIQUE
|
|
||||||
type DefineIndexStatement struct {
|
type DefineIndexStatement struct {
|
||||||
EX bool `json:"-" msgpack:"-"` // Explain
|
EX bool `codec:"-"`
|
||||||
KV string `json:"-" msgpack:"-"` // Bucket
|
KV string `codec:"-"`
|
||||||
NS string `json:"-" msgpack:"-"` // Namespace
|
NS string `codec:"-"`
|
||||||
DB string `json:"-" msgpack:"-"` // Database
|
DB string `codec:"-"`
|
||||||
Name string `json:"name" msgpack:"name"` // Index name
|
Name string `codec:"name"`
|
||||||
What []string `json:"-" msgpack:"-"` // Table names
|
What []string `codec:"-"`
|
||||||
Cols []string `json:"cols" msgpack:"cols"` // Index cols
|
Cols []string `codec:"cols"`
|
||||||
Uniq bool `json:"unique" msgpack:"unique"` // Unique index
|
Uniq bool `codec:"unique"`
|
||||||
CI bool
|
|
||||||
CS bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveIndexStatement represents an SQL REMOVE INDEX statement.
|
// RemoveIndexStatement represents an SQL REMOVE INDEX statement.
|
||||||
//
|
|
||||||
// REMOVE INDEX name ON person
|
|
||||||
type RemoveIndexStatement struct {
|
type RemoveIndexStatement struct {
|
||||||
EX bool `json:"-" msgpack:"-"` // Explain
|
EX bool `codec:"-"`
|
||||||
KV string `json:"-" msgpack:"-"` // Bucket
|
KV string `codec:"-"`
|
||||||
NS string `json:"-" msgpack:"-"` // Namespace
|
NS string `codec:"-"`
|
||||||
DB string `json:"-" msgpack:"-"` // Database
|
DB string `codec:"-"`
|
||||||
Name string `json:"-" msgpack:"-"` // Index name
|
Name string `codec:"-"`
|
||||||
What []string `json:"-" msgpack:"-"` // Table names
|
What []string `codec:"-"`
|
||||||
}
|
|
||||||
|
|
||||||
// ResyncIndexStatement represents an SQL RESYNC INDEX statement.
|
|
||||||
//
|
|
||||||
// RESYNC INDEX name ON person
|
|
||||||
type ResyncIndexStatement struct {
|
|
||||||
EX bool `json:"-" msgpack:"-"` // Explain
|
|
||||||
KV string `json:"-" msgpack:"-"` // Bucket
|
|
||||||
NS string `json:"-" msgpack:"-"` // Namespace
|
|
||||||
DB string `json:"-" msgpack:"-"` // Database
|
|
||||||
What []string `json:"-" msgpack:"-"` // Table names
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
@ -336,6 +286,23 @@ type Void struct{}
|
||||||
// Empty represents an expression which is null or "".
|
// Empty represents an expression which is null or "".
|
||||||
type Empty struct{}
|
type Empty struct{}
|
||||||
|
|
||||||
|
// Field represents a SELECT AS clause.
|
||||||
|
type Field struct {
|
||||||
|
Expr Expr
|
||||||
|
Alias string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Group represents a GROUP BY clause.
|
||||||
|
type Group struct {
|
||||||
|
Expr Expr
|
||||||
|
}
|
||||||
|
|
||||||
|
// Order represents a ORDER BY clause.
|
||||||
|
type Order struct {
|
||||||
|
Expr Expr
|
||||||
|
Dir Expr
|
||||||
|
}
|
||||||
|
|
||||||
// ClosedExpression represents a parenthesized expression.
|
// ClosedExpression represents a parenthesized expression.
|
||||||
type ClosedExpression struct {
|
type ClosedExpression struct {
|
||||||
Expr Expr
|
Expr Expr
|
||||||
|
@ -372,30 +339,58 @@ type Ident struct {
|
||||||
ID string
|
ID string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this Ident) String() string {
|
||||||
|
return this.ID
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewIdent(ID string) *Ident {
|
||||||
|
return &Ident{ID}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------
|
||||||
|
// Parts
|
||||||
|
// --------------------------------------------------
|
||||||
|
|
||||||
// Table comment
|
// Table comment
|
||||||
type Table struct {
|
type Table struct {
|
||||||
TB string
|
TB string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this Table) String() string {
|
||||||
|
return this.TB
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTable(TB string) *Table {
|
||||||
|
return &Table{TB}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------
|
||||||
|
// Parts
|
||||||
|
// --------------------------------------------------
|
||||||
|
|
||||||
// Thing comment
|
// Thing comment
|
||||||
type Thing struct {
|
type Thing struct {
|
||||||
TB string
|
TB string
|
||||||
ID interface{}
|
ID interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Field comment
|
func (this Thing) String() string {
|
||||||
type Field struct {
|
return fmt.Sprintf("@%s:%v", this.TB, this.ID)
|
||||||
Expr Expr
|
|
||||||
Alias string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group represents an sql GROUP BY clause
|
func NewThing(TB string, ID interface{}) *Thing {
|
||||||
type Group struct {
|
if str, ok := ID.(string); ok {
|
||||||
Expr Expr
|
if cnv, err := strconv.ParseFloat(str, 64); err == nil {
|
||||||
}
|
return &Thing{TB: TB, ID: cnv}
|
||||||
|
} else if cnv, err := time.Parse(RFCDate, str); err == nil {
|
||||||
// Order represents an sql ORDER BY clause
|
return &Thing{TB: TB, ID: cnv.UTC()}
|
||||||
type Order struct {
|
} else if cnv, err := time.Parse(RFCTime, str); err == nil {
|
||||||
Expr Expr
|
return &Thing{TB: TB, ID: cnv.UTC()}
|
||||||
Dir Expr
|
} else if cnv, err := time.Parse(RFCNorm, str); err == nil {
|
||||||
|
return &Thing{TB: TB, ID: cnv.UTC()}
|
||||||
|
} else if cnv, err := time.Parse(RFCText, str); err == nil {
|
||||||
|
return &Thing{TB: TB, ID: cnv.UTC()}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return &Thing{TB: TB, ID: ID}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue