-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.just
29 lines (24 loc) · 1023 Bytes
/
make.just
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
set quiet := true
PREFIX := 'cmd/lighthouse'
# create service e.g. fooer
service name:
mkdir -pv {{ PREFIX }}/services/{{ name }}
touch {{ PREFIX }}/services/{{ name }}/{{ name }}.go
echo 'package {{ name }}' > {{ PREFIX }}/services/{{ name }}/{{ name }}.go
# create model e.g. foo
model name:
mkdir -p db/repo/{{ name }}R
touch db/repo/{{ name }}R/{{ name }}.go
echo 'package {{ name }}R' > db/repo/{{ name }}R/{{ name }}.go
touch queries/{{ name }}s.sql
just make::migration 'create_{{ name }}_model'
# create controller e.g. foo
controller name:
mkdir -pv {{ PREFIX }}/controllers/{{ name }}
touch {{ PREFIX }}/controllers/{{ name }}/routes.go
touch {{ PREFIX }}/controllers/{{ name }}/routes_test.go
echo 'package {{ name }}' > {{ PREFIX }}/controllers/{{ name }}/routes.go
echo 'package {{ name }}_test' > {{ PREFIX }}/controllers/{{ name }}/routes_test.go
# create migration e.g. create_foo_model
migration name:
go run ./tools/make-migration "{{ name }}"