forked from codemodus/tote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoc.go
39 lines (39 loc) · 1.62 KB
/
doc.go
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
// Tote is a CLI application for generating structs which store SQL queries
// as defined by the directory and file structure supplied (default is
// "./sqltote"). Only .sql files are read.
//
// Available flags:
//
// --in={dir} Set the SQL storage directory. // "./sqltote"
// --out={dir} Set the tote package directory. // "./"
// --file={filename} Set the tote file name. // "sqltote.go"
// --pkg={package} Set the tote package name.
// --prefix={name} Set the tote struct prefix.
//
// Normally, this command should be called using go:generate. If called from
// the command line, "pkg" must be set. The following usage will produce a
// package named "totepkg" within the "totepkg" directory:
// //go:generate tote -in=resources/sql/tote -out=totepkg
//
// The following usage will add a second file to the "totepkg" package:
// //go:generate tote -in=other/sql/tote -out=totepkg -prefix=other -file=other.go
//
// Queries are accessible in this way:
// import "gitreposrus.com/myproject/totepkg"
//
// func main() {
// // File originally located at "./resources/sql/tote/user/all.sql"
// fmt.Println(totepkg.User.All)
//
// // File originally located at "./resources/sql/tote/user/role/many_by_user.sql"
// fmt.Println(totepkg.UserRole.ManyByUser)
//
// // File originally located at "./other/sql/tote/user/one_by_name.sql"
// fmt.Println(totepkg.OtherUser.OneByName)
// }
//
// The main caveat seems to be naming collisions which was the primary
// motivation for the prefix flag. Stay aware and problems can be avoided.
//
// This package started as a fork of smotes/purse.
package main