|
ChatGPTに
jsonファイルをコードスニペットに使用しているシステムがある
以下はsql文の
SELECTとCREATE DATABASEの例である
{
"SELECT STATEMENT": {
"prefix": "select",
"body": [
"SELECT${1: DISTINCT \n\t}${2:column_list}\n\tFROM ${3:table_name}\n${4:J
OIN }${5:table}\n${6:ON }${7:condition}\nWHERE ${8:condition}\nGROUP BY ${9:
column_list}\nHAVING ${10:condition}\nORDER BY ${11:column_list}\n${12:LIMI
T}${13: limit_value};",
""
]
},
"CREATE DATABASE": {
"prefix": "createdatabase",
"body": [
"CREATE DATABASE ${1:database_name};",
""
]
}
}
この例にもとづいて
SELECT STATEMENT
CREATE DATABASE
CREATE FUNCTION
CREATE INDEX
CREATE PROCEDURE
CREATE FUNCTION
CREATE TABLE
CREATE TRIGGER
CREATE VIEW
CREATE EVENT
のためのコードを書け
と指示したところ以下のコードを出力してくれました
{
"SELECT STATEMENT": {
"prefix": "select",
"body": [
"SELECT${1: DISTINCT}${2: column_list}\nFROM ${3:table_name}\n${4:JOI
N}${5: table}\n${6:ON}${7: condition}\nWHERE ${8:condition}\nGROUP BY ${9:co
lumn_list}\nHAVING ${10:condition}\nORDER BY ${11:column_list}\n${12:LIMIT}$
{13: limit_value};",
""
]
},
"CREATE DATABASE": {
"prefix": "createdatabase",
"body": [
"CREATE DATABASE ${1:database_name};",
""
]
},
"CREATE FUNCTION": {
"prefix": "createfunction",
"body": [
"CREATE FUNCTION ${1:function_name} (${2:parameters})\nRETURNS ${3:ret
urn_type}\n${4:BEGIN}\n\t${5:function_body}\n${6:END};",
""
]
},
"CREATE INDEX": {
"prefix": "createindex",
"body": [
"CREATE INDEX ${1:index_name}\nON ${2:table_name} (${3:column_name});",
""
]
},
"CREATE PROCEDURE": {
"prefix": "createprocedure",
"body": [
"CREATE PROCEDURE ${1:procedure_name}\n(${2:parameters})\n${3:BEGIN}\n
\t${4:procedure_body}\n${5:END};",
""
]
},
"CREATE TABLE": {
"prefix": "createtable",
"body": [
"CREATE TABLE ${1:table_name} (\n\t${2:column1} ${3:data_type},\n\t$
{4:column2} ${5:data_type},\n\t...\n);",
""
]
},
"CREATE TRIGGER": {
"prefix": "createtrigger",
"body": [
"CREATE TRIGGER ${1:trigger_name}\n${2:trigger_time} ${3:trigger_even
t} ON ${4:table_name}\nFOR EACH ROW\n${5:BEGIN}\n\t${6:trigger_body}\n${7:EN
D};",
""
]
},
"CREATE VIEW": {
"prefix": "createview",
"body": [
"CREATE VIEW ${1:view_name} AS\n${2:SELECT statement};",
""
]
},
"CREATE EVENT": {
"prefix": "createevent",
"body": [
"CREATE EVENT ${1:event_name}\n${2:ON SCHEDULE} ${3:schedule}\n${4:DO}
\n\t${5:event_action};",
""
]
}
}
|
|