Skip to content

Instantly share code, notes, and snippets.

View nakamura-to's full-sized avatar

Toshihiro Nakamura nakamura-to

View GitHub Profile
@nakamura-to
nakamura-to / EmployeeDao.java
Created November 4, 2017 13:21
Doma2でprivateメソッド
@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);
@nakamura-to
nakamura-to / AppConfig.java
Last active August 14, 2020 01:27
RedshiftのUNLOADコマンドをDomaで生成する案
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)) {
@nakamura-to
nakamura-to / Era.java
Created May 27, 2016 21:19
Doma external embeddable
@Entity
public class Era {
@Id
public Integer id;
public String name;
public Interval interval;
}
@nakamura-to
nakamura-to / EmbeddableSupport.kt
Last active May 25, 2016 12:53
Embeddable support in Doma (Kotlin)
@Embeddable
data class Address(val city: String, val street: String)
@Entity(immutable = true)
data class Person(@Id val id: Int, val name: String, val address: Address)
@nakamura-to
nakamura-to / Address.java
Last active May 25, 2016 12:49
Embeddable support in Doma
@Embeddable
public class Address {
private final String city;
private final String street;
public Address(String city, String street) {
this.city = city;
this.street = street;
}
public String getCity() {
return city;
@nakamura-to
nakamura-to / gist:c1c18dee82cabb8bc62d
Created September 13, 2015 16:22
type definitions for Redux applyMiddleware
type action = {
type: string;
};
type reducer = (state: any, action: action) => any;
type listener = () => void;
type dispatch = (action: action) => action;
select
age, name, birthday
from
person
order by
/*%if mode == 1 */
 age, name
/*%elseif mode == 2 */
/*# "name, age" */
/*%else */
@nakamura-to
nakamura-to / greeter-after.js
Last active August 29, 2015 14:09
react-toolsのjsxで変換
function Greeter(message) {"use strict";
this.greeting = message;
}
Greeter.prototype.greet=function() {"use strict";
return "Hello, " + this.greeting;
};
select email from table_a
where
primaryDomain = /*domain*/'hoge.com'
union
select email from table_b
where
/*%if userIds.size() > 0 */
member_id in /*userIds*/('aaa', 'bbb')
/*%else */
and