Compare commits

...

7 Commits

Author SHA1 Message Date
afebaf0ee6 added readme 2022-06-04 09:27:56 +02:00
2d1eb509f1 various changes 2022-06-04 09:27:49 +02:00
0409c28e4c updated build config 2022-06-04 09:27:39 +02:00
47680dff22 updated gitignore 2022-06-04 09:27:23 +02:00
32a5491472 added lix haxerc 2022-06-04 09:26:59 +02:00
34ef078dfe added lix libraries 2022-06-04 09:26:40 +02:00
28506fd3f0 renamed Document 2022-06-04 09:15:41 +02:00
31 changed files with 201 additions and 10 deletions

4
.gitignore vendored
View File

@ -1,3 +1,3 @@
api2/
./api/build/ **/build/
out.js out.js

4
api/.haxerc Normal file
View File

@ -0,0 +1,4 @@
{
"version": "4.2.5",
"resolveLibs": "scoped"
}

View File

@ -1,7 +1,8 @@
-lib tink_http -lib tink_http
-lib tink_web -lib tink_web
-lib tink_hxx #-lib tink_hxx
-lib tink_json -lib tink_json
-lib tink_sql
-lib hxnodejs -lib hxnodejs
-cp src -cp src
--main Server --main Server

View File

@ -0,0 +1,3 @@
# @install: lix --silent download "haxelib:/http-status#1.3.1" into http-status/1.3.1/haxelib
-cp ${HAXE_LIBCACHE}/http-status/1.3.1/haxelib/src
-D http-status=1.3.1

View File

@ -0,0 +1,7 @@
# @install: lix --silent download "haxelib:/hxnodejs#12.1.0" into hxnodejs/12.1.0/haxelib
-cp ${HAXE_LIBCACHE}/hxnodejs/12.1.0/haxelib/src
-D hxnodejs=12.1.0
--macro allowPackage('sys')
# should behave like other target defines and not be defined in macro context
--macro define('nodejs')
--macro _internal.SuppressDeprecated.run()

View File

@ -0,0 +1,4 @@
# @install: lix --silent download "haxelib:/tink_anon#0.7.0" into tink_anon/0.7.0/haxelib
-lib tink_macro
-cp ${HAXE_LIBCACHE}/tink_anon/0.7.0/haxelib/src
-D tink_anon=0.7.0

View File

@ -0,0 +1,7 @@
# @install: lix --silent download "haxelib:/tink_await#0.6.0" into tink_await/0.6.0/haxelib
-lib tink_core
-lib tink_macro
-lib tink_syntaxhub
-cp ${HAXE_LIBCACHE}/tink_await/0.6.0/haxelib/src
-D tink_await=0.6.0
--macro tink.await.Await.use()

View File

@ -0,0 +1,3 @@
# @install: lix --silent download "haxelib:/tink_chunk#0.4.0" into tink_chunk/0.4.0/haxelib
-cp ${HAXE_LIBCACHE}/tink_chunk/0.4.0/haxelib/src
-D tink_chunk=0.4.0

View File

@ -0,0 +1,3 @@
# @install: lix --silent download "haxelib:/tink_core#2.0.2" into tink_core/2.0.2/haxelib
-cp ${HAXE_LIBCACHE}/tink_core/2.0.2/haxelib/src
-D tink_core=2.0.2

View File

@ -0,0 +1,7 @@
# @install: lix --silent download "haxelib:/tink_http#0.10.0" into tink_http/0.10.0/haxelib
-lib http-status
-lib tink_anon
-lib tink_io
-lib tink_url
-cp ${HAXE_LIBCACHE}/tink_http/0.10.0/haxelib/src
-D tink_http=0.10.0

View File

@ -0,0 +1,5 @@
# @install: lix --silent download "haxelib:/tink_io#0.9.0" into tink_io/0.9.0/haxelib
-lib tink_chunk
-lib tink_streams
-cp ${HAXE_LIBCACHE}/tink_io/0.9.0/haxelib/src
-D tink_io=0.9.0

View File

@ -0,0 +1,4 @@
# @install: lix --silent download "haxelib:/tink_json#0.11.0" into tink_json/0.11.0/haxelib
-lib tink_typecrawler
-cp ${HAXE_LIBCACHE}/tink_json/0.11.0/haxelib/src
-D tink_json=0.11.0

View File

@ -0,0 +1,4 @@
# @install: lix --silent download "haxelib:/tink_macro#1.0.0" into tink_macro/1.0.0/haxelib
-lib tink_core
-cp ${HAXE_LIBCACHE}/tink_macro/1.0.0/haxelib/src
-D tink_macro=1.0.0

View File

@ -0,0 +1,3 @@
# @install: lix --silent download "haxelib:/tink_priority#0.1.4" into tink_priority/0.1.4/haxelib
-cp ${HAXE_LIBCACHE}/tink_priority/0.1.4/haxelib/src
-D tink_priority=0.1.4

View File

@ -0,0 +1,5 @@
# @install: lix --silent download "haxelib:/tink_querystring#0.7.0" into tink_querystring/0.7.0/haxelib
-lib tink_typecrawler
-lib tink_url
-cp ${HAXE_LIBCACHE}/tink_querystring/0.7.0/haxelib/src
-D tink_querystring=0.7.0

View File

@ -0,0 +1,3 @@
# @install: lix --silent download "gh://github.com/haxetink/tink_spatial#fb0d0a02ceed49325709215b5da0062fd8316c62" into tink_spatial/0.1.0/github/fb0d0a02ceed49325709215b5da0062fd8316c62
-cp ${HAXE_LIBCACHE}/tink_spatial/0.1.0/github/fb0d0a02ceed49325709215b5da0062fd8316c62/src
-D tink_spatial=0.1.0

View File

@ -0,0 +1,7 @@
# @install: lix --silent download "gh://github.com/haxetink/tink_sql#3b8fef55ba9153b78c07e8722a76d077f4d40cb8" into tink_sql/0.0.0-alpha.0/github/3b8fef55ba9153b78c07e8722a76d077f4d40cb8
-lib tink_macro
-lib tink_spatial
-lib tink_streams
-lib tink_url
-cp ${HAXE_LIBCACHE}/tink_sql/0.0.0-alpha.0/github/3b8fef55ba9153b78c07e8722a76d077f4d40cb8/src
-D tink_sql=0.0.0-alpha.0

View File

@ -0,0 +1,6 @@
# @install: lix --silent download "gh://github.com/haxetink/tink_streams#c51ff28d69ea844995696f10575d1a150ce47159" into tink_streams/0.3.3/github/c51ff28d69ea844995696f10575d1a150ce47159
-lib tink_core
-cp ${HAXE_LIBCACHE}/tink_streams/0.3.3/github/c51ff28d69ea844995696f10575d1a150ce47159/src
-D tink_streams=0.3.3
# temp for development, delete this file when pure branch merged
-D pure

View File

@ -0,0 +1,4 @@
# @install: lix --silent download "haxelib:/tink_stringly#0.4.0" into tink_stringly/0.4.0/haxelib
-lib tink_core
-cp ${HAXE_LIBCACHE}/tink_stringly/0.4.0/haxelib/src
-D tink_stringly=0.4.0

View File

@ -0,0 +1,6 @@
# @install: lix --silent download "haxelib:/tink_syntaxhub#0.5.0" into tink_syntaxhub/0.5.0/haxelib
-lib tink_macro
-lib tink_priority
-cp ${HAXE_LIBCACHE}/tink_syntaxhub/0.5.0/haxelib/src
-D tink_syntaxhub=0.5.0
--macro tink.SyntaxHub.use()

View File

@ -0,0 +1,4 @@
# @install: lix --silent download "haxelib:/tink_typecrawler#0.7.0" into tink_typecrawler/0.7.0/haxelib
-lib tink_macro
-cp ${HAXE_LIBCACHE}/tink_typecrawler/0.7.0/haxelib/src
-D tink_typecrawler=0.7.0

View File

@ -0,0 +1,5 @@
# @install: lix --silent download https://github.com/haxetink/tink_url/archive/7c98a2ea212c3a2f8d9ff41c1450eae98eee812f.tar.gz into tink_url/0.3.1/github/7c98a2ea212c3a2f8d9ff41c1450eae98eee812f
-D tink_url=0.3.1
-cp ${HAXESHIM_LIBCACHE}/tink_url/0.3.1/github/7c98a2ea212c3a2f8d9ff41c1450eae98eee812f/src
-lib tink_stringly

View File

@ -0,0 +1,6 @@
# @install: lix --silent download "haxelib:/tink_web#0.3.0" into tink_web/0.3.0/haxelib
-lib tink_http
-lib tink_json
-lib tink_querystring
-cp ${HAXE_LIBCACHE}/tink_web/0.3.0/haxelib/src
-D tink_web=0.3.0

0
api/readme.md Normal file
View File

View File

@ -1,9 +1,10 @@
import html.Document; import html.WebDocument;
import tink.http.containers.*; import tink.http.containers.*;
import tink.http.Response; import tink.http.Response;
import tink.web.routing.*; import tink.web.routing.*;
import haxe.Json; import haxe.Json;
import tink.sql.drivers.Sqlite;
import db.Db;
typedef T_project = { typedef T_project = {
@ -29,16 +30,40 @@ class Server {
} }
class Root { class Root {
public function new() {} public function new() {}
@:get('/') @:get('/')
@:produces('text/html') @:produces('text/html')
public function root(){ public function root(){
return Document.render(); //return "yeet";
return WebDocument.render();
}
@:get('/test')
@:produces('text/html')
@async
public function create(){
//return "yeet";
var yeet = "yote";
var driver = new tink.sql.drivers.Sqlite();
@await var db = new Db('daba2', driver);
@await var one = db.User.create();
@await var two = db.User.insertOne({
id: cast null,
name: 'Alice',
email: 'alice@example.com',
password: 'jew'
});
@await var three = db.User.select({name: User.name, email: User.email}).where(User.email == 'alice@example.com').first().next(function(row) {
trace(row.name);return "";
});
// trace(@await one);
// trace(@await two);
trace(@await three);
return '$yeet';
} }
@:sub('/projects') @:sub('/projects')
@:produces('application/json')
public function projects() public function projects()
return new Projects(); return new Projects();
@ -49,6 +74,7 @@ class Root {
var strout:String = tink.Json.stringify(greeting); var strout:String = tink.Json.stringify(greeting);
return strout; return strout;
} }
} }
class Projects { class Projects {

10
api/src/db/Connection.hx Normal file
View File

@ -0,0 +1,10 @@
package db;
import tink.sql.drivers.sys.Sqlite;
import tink.sql.drivers.MySql;
import db.Db;
class Connection{
private static var driver = new tink.sql.drivers.Sqlite();
public static var db = new Db('daba', driver);
}

17
api/src/db/Db.hx Normal file
View File

@ -0,0 +1,17 @@
package db;
// import tink.sql.drivers.Sqlite;
//import tink.sql.Database;
import tink.sql.Types;
import model.User;
// import db.Models.User;
typedef Db = tink.sql.Database<Def>;
@:tables(User)
interface Def extends tink.sql.DatabaseDefinition {
//@:procedure var func:Int->{x:Int, point:tink.s2d.Point};
//@:table('user') var UserAlias:User;
}

11
api/src/db/Models.hx Normal file
View File

@ -0,0 +1,11 @@
package db;
import tink.sql.Types;
typedef User = {
@:autoIncrement @:primary public var id(default, null):Id<User>;
var name:VarChar<255>;
@:unique var email:VarChar<255>;
var password:VarChar<255>;
}

View File

@ -1,8 +1,14 @@
package html; package html;
class Document{ //import tink.web.macros.Routing;
import tink.web.routing.*;
import tink.web.routing.Router;
class WebDocument{
public static function render():String public static function render():String
{ {
var docroot:Tag = new Tag("html"); var docroot:Tag = new Tag("html");
var head:Tag = new Tag("head"); var head:Tag = new Tag("head");
var body:Tag = new Tag("body"); var body:Tag = new Tag("body");

11
api/src/model/User.hx Normal file
View File

@ -0,0 +1,11 @@
package model;
import tink.sql.Types;
typedef User = {
@:autoIncrement @:primary public var id(default, null):Id<User>;
public var name:VarChar<50>;
public var email:VarChar<50>;
public var password:VarChar<50>;
}

View File

@ -0,0 +1,9 @@
package model.cctweaked;
import tink.sql.Types;
typedef HTurtle = {
@:autoIncrement @:primary public var id(default, null):Id<HTurtle>;
public var name:VarChar<50>;
public var password:VarChar<50>;
}