{ "Function": { "prefix": "fun", "body": [ "fun ${1:name}(${2}): ${3:Unit} {", " $0", "}" ], "description": "Gotlin function" }, "Main Function": { "prefix": "main", "body": [ "fun main() {", " $0", "}" ], "description": "Gotlin main function" }, "Package": { "prefix": "package", "body": ["package ${1:demo}"], "description": "Gotlin package declaration" }, "Go Import": { "prefix": "importgo", "body": ["import ${1:alias} \"${2:example.com/module/package}\""], "description": "Import a Go module path with an alias" }, "Data Class": { "prefix": "dataclass", "body": [ "data class ${1:Name}(", " val ${2:value}: ${3:String}", ")" ], "description": "Gotlin data class" }, "SQL Table Row": { "prefix": "tablerow", "body": [ "@table(\"${1:table_name}\")", "data class ${2:Row}(", " @generated @id val ${3:id}: ${4:Int},", " @column(\"${5:value}\") var ${6:value}: ${7:String}", ")" ], "description": "Annotated SQL table row data class" }, "Embedded Value": { "prefix": "embed", "body": ["@embed(\"${1:path/to/file}\") val ${2:name}: ${3:ByteSlice}"], "description": "Embed a file as a top-level value" }, "Worker": { "prefix": "worker", "body": [ "worker ${1:Name} {", " var ${2:state}: ${3:Int} = ${4:0}", "", " fun ${5:run}() {", " $0", " }", "}" ], "description": "Stateful Gotlin worker" }, "Rust-style Enum": { "prefix": "enum", "body": [ "enum ${1:Result} {", " ${2:Success}(${3:String})", " ${4:Failure}(${5:String})", " ${6:Pending}", "}" ], "description": "Rust-style algebraic enum" }, "Exhaustive Enum Match": { "prefix": "match", "body": [ "match (${1:result}) {", " ${2:Result}::${3:Success}(${4:value}) -> {", " $5", " }", " ${2:Result}::${6:Failure}(${7:reason}) -> {", " $8", " }", " ${2:Result}::${9:Pending} -> {", " $0", " }", "}" ], "description": "Exhaustive match over enum variants" }, "Recursive Structural Mapping": { "prefix": "mapto", "body": ["val ${1:target} = ${2:source}.mapTo<${3:Target}>()"], "description": "Recursively map compatible classes or enums" }, "Go Block": { "prefix": "go", "body": [ "go {", " $0", "}" ], "description": "Run a block concurrently" }, "Defer Call": { "prefix": "defer", "body": ["defer ${1:resource}.${2:close}()"], "description": "Defer a function call" }, "For Each": { "prefix": "foreach", "body": [ "for (${1:item} in ${2:items}) {", " $0", "}" ], "description": "Iterate over a collection" }, "Typed SQL Fetch": { "prefix": "sqlfetch", "body": [ "val ${1:rows}: List<*${2:Row}> = sql.from<${2:Row}>()", " .where { ${3:it.id == id} }", " .fetch(${4:pool}, ${5:ctx})" ], "description": "Fetch typed SQL rows" }, "Typed SQL Single": { "prefix": "sqlsingle", "body": [ "val ${1:row}: *${2:Row} = sql.from<${2:Row}>()", " .where { ${3:it.id == id} }", " .single(${4:pool}, ${5:ctx})" ], "description": "Fetch one typed SQL row" }, "Typed SQL Iterator": { "prefix": "sqliterator", "body": [ "val ${1:rows}: GotlinSQLIterator<${2:Row}> = sql.from<${2:Row}>()", " .where { ${3:it.id == id} }", " .iterator(${4:pool}, ${5:ctx})" ], "description": "Iterate over typed SQL rows" }, "SQL Insert On Conflict Do Nothing": { "prefix": "sqlinsertnothing", "body": [ "sql.insert<${1:Row}>(${2:row})", " .onConflict { ${3:it.id} }", " .doNothing()", " .build()" ], "description": "Build an insert that ignores a typed conflict" }, "SQL Insert On Conflict Do Update": { "prefix": "sqlinsertupdate", "body": [ "sql.insert<${1:Row}>(${2:row})", " .onConflict { ${3:it.id} }", " .doUpdate { ${4:excluded} ->", " set(${1:Row}.${5:value}, ${4:excluded}.${5:value})", " }", " .build()" ], "description": "Build an insert that updates on a typed conflict" }, "SQL Update Returning": { "prefix": "sqlupdatereturning", "body": [ "val ${1:updated}: *${2:Row} = sql.update<${2:Row}>()", " .set { ${3:row} ->", " set(${3:row}.${4:value}, ${5:newValue})", " }", " .where { ${6:it.id == id} }", " .returning { it }", " .single(${7:pool}, ${8:ctx})" ], "description": "Update and return a typed SQL row" }, "If": { "prefix": "if", "body": [ "if (${1:condition}) {", " $0", "}" ], "description": "If statement" }, "Lambda": { "prefix": "lambda", "body": ["{ ${1:it} -> $0 }"], "description": "Lambda expression" }, "Override Method": { "prefix": "override", "body": [ "override fun ${1:name}(${2}): ${3:Unit} {", " $0", "}" ], "description": "Override a class or interface method" } }