-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a8c03d2
commit a828270
Showing
7 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package nodes | ||
|
||
// ILikeNode represents equals operator | ||
type ILikeNode struct { | ||
name NameNode | ||
right Node | ||
} | ||
|
||
// NewILikeNode returns new ILikeNode | ||
func NewILikeNode(name NameNode, right Node) ILikeNode { | ||
return ILikeNode{ | ||
name: name, | ||
right: right, | ||
} | ||
} | ||
|
||
// Name returns name | ||
func (n ILikeNode) Name() NameNode { | ||
return n.name | ||
} | ||
|
||
// Childs returns collection of childs | ||
func (n ILikeNode) Childs() []Node { | ||
return []Node{n.right} | ||
} | ||
|
||
// Right returns child | ||
func (n ILikeNode) Right() Node { | ||
return n.right | ||
} | ||
|
||
// Accept accepts translate visitor to invoke TranslateILikeNode method | ||
func (n ILikeNode) Accept(visitor TranslateVisitor) string { | ||
return visitor.TranslateILikeNode(n) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package nodes | ||
|
||
// LikeNode represents equals operator | ||
type LikeNode struct { | ||
name NameNode | ||
right Node | ||
} | ||
|
||
// NewLikeNode returns new LikeNode | ||
func NewLikeNode(name NameNode, right Node) LikeNode { | ||
return LikeNode{ | ||
name: name, | ||
right: right, | ||
} | ||
} | ||
|
||
// Name returns name | ||
func (n LikeNode) Name() NameNode { | ||
return n.name | ||
} | ||
|
||
// Childs returns collection of childs | ||
func (n LikeNode) Childs() []Node { | ||
return []Node{n.right} | ||
} | ||
|
||
// Right returns child | ||
func (n LikeNode) Right() Node { | ||
return n.right | ||
} | ||
|
||
// Accept accepts translate visitor to invoke TranslateLikeNode method | ||
func (n LikeNode) Accept(visitor TranslateVisitor) string { | ||
return visitor.TranslateLikeNode(n) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package operators | ||
|
||
import ( | ||
"github.com/Delisa-sama/stmt-builder/nodes" | ||
"github.com/Delisa-sama/stmt-builder/statement" | ||
) | ||
|
||
type ilike struct { | ||
value string | ||
} | ||
|
||
// ILIKE represents ILIKE operator | ||
func ILIKE(value string) statement.Operator { | ||
return ilike{value: value} | ||
} | ||
|
||
// Node returns EqNode | ||
func (o ilike) Node(leftOp string) nodes.Node { | ||
return nodes.NewLikeNode(nodes.NewNameNode(leftOp), nodes.NewStringNode(o.value)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package operators | ||
|
||
import ( | ||
"github.com/Delisa-sama/stmt-builder/nodes" | ||
"github.com/Delisa-sama/stmt-builder/statement" | ||
) | ||
|
||
type like struct { | ||
value string | ||
} | ||
|
||
// LIKE represents LIKE operator | ||
func LIKE(value string) statement.Operator { | ||
return like{value: value} | ||
} | ||
|
||
// Node returns EqNode | ||
func (o like) Node(leftOp string) nodes.Node { | ||
return nodes.NewLikeNode(nodes.NewNameNode(leftOp), nodes.NewStringNode(o.value)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters