-
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
2d85d10
commit fb537b7
Showing
7 changed files
with
289 additions
and
34 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,22 @@ | ||
package mysql | ||
|
||
import ( | ||
"github.com/ditrit/badaas/orm/operator" | ||
"github.com/ditrit/badaas/orm/sql" | ||
) | ||
|
||
// Pattern Matching | ||
|
||
// As an extension to standard SQL, MySQL permits LIKE on numeric expressions. | ||
func Like[T string | | ||
int | int8 | int16 | int32 | int64 | | ||
uint | uint8 | uint16 | uint32 | uint64 | | ||
float32 | float64](pattern string, | ||
) operator.Operator[T] { | ||
return operator.NewValueOperator[T](sql.Like, pattern) | ||
} | ||
|
||
// ref: https://dev.mysql.com/doc/refman/8.0/en/regexp.html#operator_regexp | ||
func RegexP(pattern string) operator.Operator[string] { | ||
return operator.NewValueOperator[string](sql.MySQLRegexp, pattern) | ||
} |
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,11 @@ | ||
package mysql | ||
|
||
import ( | ||
"github.com/ditrit/badaas/orm/condition" | ||
"github.com/ditrit/badaas/orm/model" | ||
"github.com/ditrit/badaas/orm/sql" | ||
) | ||
|
||
func Xor[T model.Model](conditions ...condition.WhereCondition[T]) condition.WhereCondition[T] { | ||
return condition.NewConnectionCondition(sql.MySQLXor, conditions...) | ||
} |
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,27 @@ | ||
package psql | ||
|
||
import ( | ||
"github.com/ditrit/badaas/orm/operator" | ||
"github.com/ditrit/badaas/orm/sql" | ||
) | ||
|
||
// Pattern Matching | ||
|
||
func ILike(pattern string) operator.Operator[string] { | ||
return operator.NewValueOperator[string](sql.PostgreSQLILike, pattern) | ||
} | ||
|
||
// ref: https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-SIMILARTO-REGEXP | ||
func SimilarTo(pattern string) operator.Operator[string] { | ||
return operator.NewValueOperator[string](sql.PostgreSQLSimilarTo, pattern) | ||
} | ||
|
||
// ref: https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-POSIX-REGEXP | ||
func POSIXMatch(pattern string) operator.Operator[string] { | ||
return operator.NewValueOperator[string](sql.PostgreSQLPosixMatch, pattern) | ||
} | ||
|
||
// ref: https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-POSIX-REGEXP | ||
func POSIXIMatch(pattern string) operator.Operator[string] { | ||
return operator.NewValueOperator[string](sql.PostgreSQLPosixIMatch, pattern) | ||
} |
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,11 @@ | ||
package sqlite | ||
|
||
import ( | ||
"github.com/ditrit/badaas/orm/operator" | ||
"github.com/ditrit/badaas/orm/sql" | ||
) | ||
|
||
// ref: https://www.sqlie.org/lang_expr.html#like | ||
func Glob(pattern string) operator.Operator[string] { | ||
return operator.NewValueOperator[string](sql.SQLiteGlob, pattern) | ||
} |
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