metaapi

command module
v0.0.0-...-966525a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2023 License: MIT Imports: 9 Imported by: 0

README

metaapi (v4.0)

New for v4:

  • Support BYTEA
  • Support GENERATED

Generate go CRUD and HTTP api and test functions from sql table definitions

New for v3:

  • Project setup for a fully functioning web server with Vue/Vuetify
  • Automatic public HTTP api (routes and handlers, Gorilla Mux) on top of the CRUD api
  • Automatic tests for the HTTP api
  • Support for Go/PostgreSQL NULL fields/data
  • Simple Vuetify table view page for data

v3.0 matches Medium article:

  • Automatic Applications in Go

Previous versions:

Pull the v1.0 tag metaapi commit to have code that matches the original Medium article:

Pull the v2.0 tag metaapi commit to have code that matches the Medium article:

See also:

Most Common Scenario:

#assume project and database name: todo (can be anything)
#assume sql file: events.sql (from examples, but can be anything)
createuser -P -d todo <pass: todo>
createdb todo
go get github.com/exyzzy/metaapi
go install $GOPATH/src/github.com/exyzzy/metaapi
go get github.com/exyzzy/metaproj
go install $GOPATH/src/github.com/exyzzy/metaproj
cp $GOPATH/src/github.com/exyzzy/metaapi/examples/events.sql .
metaproj -sql=events.sql -proj=todo -type=vue
cd todo
go generate
go install
go test

Legacy:

Example Using Internal Files, no metaproj

go get github.com/exyzzy/metaapi
go install $GOPATH/src/github.com/exyzzy/metaapi
mkdir myproj
cd myproj
cp $GOPATH/src/github.com/exyzzy/metaapi/examples/todo.sql .
cp $GOPATH/src/github.com/exyzzy/metaapi/examples/todo.go .
go generate

Example Using Internal Files, with metaproj

go get github.com/exyzzy/metaapi
go install $GOPATH/src/github.com/exyzzy/metaapi
go get github.com/exyzzy/metaproj
go install $GOPATH/src/github.com/exyzzy/metaproj
cp $GOPATH/src/github.com/exyzzy/metaapi/examples/alltypes.sql .
metaproj -sql=alltypes.sql -proj=myproj 
cd myproj
createuser -P -d myproj
# use password: myproj
createdb myproj
go generate
go test

Example Using External Files, with metaproj and pipe

go get github.com/exyzzy/metaapi
go install $GOPATH/src/github.com/exyzzy/metaapi
go get github.com/exyzzy/metaproj
go install $GOPATH/src/github.com/exyzzy/metaproj
go get github.com/exyzzy/pipe
go install $GOPATH/src/github.com/exyzzy/pipe
cp $GOPATH/src/github.com/exyzzy/metaapi/examples/alltypes.sql .
metaproj -sql=alltypes.sql -proj=myproj -type=external 
cd myproj
createuser -P -d myproj
# use password: myproj
createdb myproj
go install
go generate
go test

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package main Code generated by go-bindata.
Package main Code generated by go-bindata.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL