File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
src/main/java/org/mybatis/dynamic/sql/insert Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright 2016-2020 the original author or authors.
2+ * Copyright 2016-2021 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
2929import org .mybatis .dynamic .sql .util .NullMapping ;
3030import org .mybatis .dynamic .sql .util .StringConstantMapping ;
3131import org .mybatis .dynamic .sql .util .ValueMapping ;
32+ import org .mybatis .dynamic .sql .util .ValueOrNullMapping ;
3233import org .mybatis .dynamic .sql .util .ValueWhenPresentMapping ;
3334
3435public class GeneralInsertDSL implements Buildable <GeneralInsertModel > {
@@ -88,6 +89,15 @@ public GeneralInsertDSL toValue(Supplier<T> valueSupplier) {
8889 return GeneralInsertDSL .this ;
8990 }
9091
92+ public GeneralInsertDSL toValueOrNull (T value ) {
93+ return toValueOrNull (() -> value );
94+ }
95+
96+ public GeneralInsertDSL toValueOrNull (Supplier <T > valueSupplier ) {
97+ insertMappings .add (ValueOrNullMapping .of (column , valueSupplier ));
98+ return GeneralInsertDSL .this ;
99+ }
100+
91101 public GeneralInsertDSL toValueWhenPresent (T value ) {
92102 return toValueWhenPresent (() -> value );
93103 }
You can’t perform that action at this time.
0 commit comments