aboutsummaryrefslogtreecommitdiff
path: root/template/go/pattern.stpl
blob: 70c60e629ce255beba493243687914549c1981eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
\(\S\+\)\.var$
	var {{$1}} = {{_cursor_}}

\(\S\+\)\.iferr$
	if {{$1}} != nil {
		return {{$1}}
	}
	{{_cursor_}}

\(\S\+\)\.fatal$
	if {{$1}} != nil {
		log.Fatal({{$1}})
	}
	{{_cursor_}}

\(\S\+\)\.log$
	log.Println({{$1}})
	{{_cursor_}}

\(\S\+\)\.close$
	defer {{$1}}.Close()
	{{_cursor_}}

\(\S\+\)\.query$
	{{$1}}.Query("{{_cursor_}}")

\(\S.*\)\.pr\%[int]$
	fmt.Print({{$1}})
	{{_cursor_}}

\(\S.*\)\.pr\%[int]f$
	fmt.Printf({{$1}})
	{{_cursor_}}

\(\S.*\)\.pr\%[int]l\%[n]$
	fmt.Println({{$1}})
	{{_cursor_}}

\(\S.*\)\.fpr\%[int]$
	fmt.Fprint({{$1}})
	{{_cursor_}}

\(\S.*\)\.fpr\%[int]f$
	fmt.Fprintf({{$1}})
	{{_cursor_}}

\(\S.*\)\.fpr\%[int]l\%[n]$
	fmt.Fprintln({{$1}})
	{{_cursor_}}

\(\S.*\)\.spr\%[int]$
	{{_cursor_}} fmt.Sprint({{$1}})

\(\S.*\)\.spr\%[int]f$
	{{_cursor_}} fmt.Sprintf({{$1}})

\(\S.*\)\.spr\%[int]l\%[n]$
	{{_cursor_}} fmt.Sprintln({{$1}})

\(\S\+\)\.func$
	func {{$1}} {
		{{_cursor_}}
	}

\(\S\+\)\.struct$
	type {{$1}} struct {
		{{_cursor_}}
	}

\(\S\+\)\.int$
	{{$1}}	int
	{{_cursor_}}

\(\S\+\)\.string$
	{{$1}}	string
	{{_cursor_}}

\(\S\+\)\.bool$
	{{$1}}	bool
	{{_cursor_}}

\(\S\+\)\.append$
	{{$1}} = append({{$1}}, {{_cursor_}})

\(\S\+\)\.jsondecode$
	if err := json.NewDecoder({{$1}}).Decode({{_cursor_}}); err != nil {
		return err
	}

\(\S\+\)\.jsonencode$
	if err := json.NewEncoder({{$1}}).Encode({{_cursor_}}); err != nil {
		return err
	}