ラムダで指定できなくはないが、型パラメータが面倒臭いことになる
val query = select({ it.name }, from = ::_Emp) { e -> where { eq(e.id, 1) }}
package sample; | |
public class AppConfig implements Config { | |
@Override | |
public QueryImplementors getQueryImplementors() { | |
return new QueryImplementors() { | |
@Override | |
public SqlFileSelectQuery createSqlFileSelectQuery(Method method) { | |
if (method.isAnnotationPresent(Unload.class)) { |
val query = select(::_製品移動) { a -> | |
val b = leftJoin(::_倉庫) { b -> | |
eq(a.移送元倉庫id, b.倉庫id) | |
} | |
val c = leftJoin(::_倉庫) { c -> | |
eq(a.移送先倉庫id, c.倉庫id) | |
} | |
associate(a, b) { 製品移動, 倉庫 -> | |
製品移動.移送元倉庫 = 倉庫 | |
} |
open System | |
open System.Collections.Generic | |
open System.Net | |
open System.Net.Http | |
open System.Web.Http | |
open System.Web.Http.Dispatcher | |
open System.Web.Http.SelfHost | |
open Microsoft.VisualStudio.TestTools.UnitTesting | |
open Newtonsoft.Json.Linq | |
open Newtonsoft.Json.Serialization |
// see http://d.hatena.ne.jp/ashigeru/20090113/1231855642 | |
var calc = { | |
add: function (node) { | |
return visit(this, node.l) + visit(this, node.r); | |
}, | |
sub: function (node) { | |
return visit(this, node.l) - visit(this, node.r); | |
}, | |
val: function (node) { |
@Dao | |
public interface FooDao { | |
public default <R> R findByIds(List<FooId> ids, Collector<Foo, ?, R> collctor) { | |
FooInteranlDao dao = DaoFactory.get(FooInteranlDao.class); | |
return Lists.partition(ids, 5000).stream() // partition は List<A> を 第二引数の数ごと区切ってList<List<A>> にする処理です | |
flatMap(dao::findByIdsInternally) | |
collect(collctor); | |
} | |
} |
@Dao | |
public interface EmployeeDao { | |
default List<Employee> selectWithBuilder() { | |
return selectWithBuilder_private(); | |
} | |
private List<Employee> selectWithBuilder_private() { | |
Config config = Config.get(this); | |
SelectBuilder builder = SelectBuilder.newInstance(config); |
open System.Data.SqlClient | |
open Tranq | |
open Tranq.Directive | |
let insert = required { | |
let! _ = Database.execute "insert person (id, name) values (1, 'hoge1')" | |
let! _ = Database.execute "insert person (id, name) values (2, 'hoge2')" | |
let! _ = Database.execute "insert person (id, name) values (3, 'hoge3')" | |
return () } |
function f(a, b, c) { | |
console.log(this); | |
console.log(a); | |
console.log(b); | |
console.log(c); | |
} | |
var context = { | |
name: 'context' | |
}; |