init commit

This commit is contained in:
unknown
2025-08-19 08:06:37 -04:00
commit 2957b5515a
743 changed files with 45495 additions and 0 deletions
@@ -0,0 +1,8 @@
list: user.code_common_function
code.language: sql
-
# these vary by dialect
count: Count
min: Min
max: Max
+46
View File
@@ -0,0 +1,46 @@
from talon import Context, actions
from ..tags.operators import Operators
ctx = Context()
ctx.matches = r"""
code.language: sql
"""
operators = Operators(
MATH_ADD=" + ",
MATH_SUBTRACT=" - ",
MATH_MULTIPLY=" * ",
MATH_DIVIDE=" / ",
MATH_EQUAL=" = ",
MATH_NOT_EQUAL=" <> ",
MATH_GREATER_THAN=" > ",
MATH_GREATER_THAN_OR_EQUAL=" >= ",
MATH_LESS_THAN=" < ",
MATH_LESS_THAN_OR_EQUAL=" <= ",
MATH_IN=lambda: actions.user.insert_between(" IN (", ")"),
MATH_NOT_IN=lambda: actions.user.insert_between(" NOT IN (", ")"),
MATH_AND=" AND ",
MATH_OR=" OR ",
)
@ctx.action_class("user")
class UserActions:
def code_get_operators() -> Operators:
return operators
def code_insert_null():
actions.auto_insert("NULL")
def code_insert_is_null():
actions.auto_insert(" IS NULL")
def code_insert_is_not_null():
actions.auto_insert(" IS NOT NULL")
def code_insert_function(text: str, selection: str):
substitutions = {"1": text}
if selection:
substitutions["0"] = selection
actions.user.insert_snippet_by_name("functionCall", substitutions)
+33
View File
@@ -0,0 +1,33 @@
code.language: sql
-
tag(): user.code_operators_math
tag(): user.code_comment_line
tag(): user.code_comment_block_c_like
tag(): user.code_data_null
tag(): user.code_functions_common
select: "SELECT "
distinct: "DISTINCT "
from: "FROM "
select star from: "SELECT *\nFROM "
where: "WHERE "
order by: "ORDER BY "
group by: "GROUP BY "
having: "HAVING "
descending: " DESC"
ascending: " ASC"
dot i d: ".id"
inner join: user.insert_between("INNER JOIN ", " ON ")
inner join using: user.insert_between("INNER JOIN ", " USING ")
left outer join: user.insert_between("LEFT OUTER JOIN ", " ON ")
right outer join: user.insert_between("RIGHT OUTER JOIN ", " ON ")
with: user.insert_snippet_by_name("withStatement")
column:
key(return)
", "
count: user.code_insert_function("Count", "")
date: user.insert_between("DATE '", "'")