nvim/snippets/go.json
2024-02-22 21:19:55 +08:00

44 lines
662 B
JSON

{
"class": {
"prefix": "class",
"body": "type $1 struct{$2}\n$0"
},
"errnil": {
"prefix": "errnil",
"body": [
"if err != nil {",
" $1",
"}"
]
},
"init": {
"prefix": "init",
"body": [
"func init() {",
" $1",
"}"
]
},
"ctx": {
"prefix": "ctx",
"body": [
"ctx := context.Background()"
]
},
"cok": {
"prefix": "cok",
"body": [
"c.JSON(http.StatusOK, vo.Success($1))"
]
},
"cbad": {
"prefix": "cbad",
"body": [
"if err != nil {",
" c.JSON(http.StatusBadRequest, vo.Fail(err))",
" return",
"}"
]
}
}