rename type build script + add controller build script + update 'readme' to _checkable_ changelog

This commit is contained in:
Adrien Marquès 2018-05-31 09:23:06 +02:00
parent 5bd9e2f688
commit be180c8d95
4 changed files with 66 additions and 12 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.so
/types
/controllers
/test

View File

@ -11,16 +11,27 @@ It is based on the *all-in-config* idea, where you only have a configuration fi
Here's a taste of some features:
- human-readable json configuration
- nested routes (*i.e. `/user/:id:` vs. `/user/post/:id:`*)
- useful http methods: GET, POST, PUT, DELETE
- manage URL, query and body arguments:
- multipart/form-data
- application/x-www-form-urlencoded
- application/json
- required vs. optional parameters with a default value
- parameter renaming
- generic authentication system (*i.e. you can override the built-in*)
- generic type check (*i.e. implement your types alongside built-in types*)
##### changelog
- [x] human-readable json configuration
- [x] nested routes (*i.e. `/user/:id:` and `/user/post/:id:`*)
- [ ] nested URL arguments (*i.e. `/user/:id:` and `/user/:id:/post/:id:`*)
- [x] useful http methods: GET, POST, PUT, DELETE
- [x] manage URL, query and body arguments:
- [x] multipart/form-data (variables and file uploads)
- [x] application/x-www-form-urlencoded
- [x] application/json
- [x] required vs. optional parameters with a default value
- [x] parameter renaming
- [ ] generic authentication system (*i.e. you can override the built-in one*)
- [x] generic type check (*i.e. implement custom types alongside built-in ones*)
- [ ] built-in types
- [x] `any` - wildcard matching all values
- [x] `int` - any number (*e.g. float, int, uint*)
- [x] `string` - any text
- [x] `varchar(min, max)` - any string with a length between `min` and `max`
- [ ] `<a>` - array containing **only** elements matching `a` type
- [ ] `<a:b>` - map containing **only** keys of type `a` and values of type `b` (*a or b can be ommited*)
- [ ] generic controllers implementation (shared objects)
- [ ] response interface

42
build-controllers.sh Normal file
View File

@ -0,0 +1,42 @@
#!/bin/bash
# (1) Check argument
#--------------------------------------------------------#
if [ "$#" -lt 1 -o ! -d "$1" ]; then
echo -e "\e[33mERROR\e[0m missing parameter\n"
echo -e "+ expected first argument to be the controller's folder"
exit 1;
fi
# (1) Get controller path #
BASE_DIR="`realpath $(pwd)`"
CTL_PATH="`realpath $1`";
# (2) List go files #
cd $CTL_PATH
GO_FILES="`ls *.go **/*.go`"
# (3) Create target directory in execution dir #
mkdir -p $BASE_DIR/controllers;
# (4) Build each file #
d=1
for file in $GO_FILES; do
ctl="${file%.*}" # remove extension from path
echo -e "($d) Building \e[33m$ctl\e[0m";
# build into execution dir
go build -buildmode=plugin -ldflags "-s -w" -o "$BASE_DIR/controllers/$ctl.so" ./$file;
# Manage failure
if [ "$?" -ne "0" ]; then
echo -e "\e[31m/!\\ \e[0merror building \e[33m$ctl\e[0m\n"
fi
d=""`expr $d + 1`""
done;
# (5) ACK #
echo -e "\n[ \e[32mfinished\e[0m ]\n"
echo -e "files are located inside the relative \e[33m./controllers\e[0m directory"