Class SQLInserts
- java.lang.Object
-
- net.andreinc.mockneat.abstraction.MockUnitBase
-
- net.andreinc.mockneat.unit.text.SQLInserts
-
public class SQLInserts extends MockUnitBase implements MockUnit<SQLInsert>
-
-
Field Summary
-
Fields inherited from class net.andreinc.mockneat.abstraction.MockUnitBase
mockNeat
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSQLInserts()SQLInserts(MockNeat mockNeat)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SQLInsertscolumn(java.lang.String column, java.lang.String str)Associates a column of the SQL table with a constant value.SQLInsertscolumn(java.lang.String column, java.lang.String str, java.util.function.Function<java.lang.String,java.lang.String> sqlFormatter)Associates a column of the SQL table with a constant value.SQLInsertscolumn(java.lang.String column, MockUnit<?> mockUnit)Associates a column of the SQL table with a correspondingMockUnit<T>SQLInsertscolumn(java.lang.String column, MockUnit<?> mockUnit, java.util.function.Function<java.lang.String,java.lang.String> sqlFormatter)Associates a column of the SQL table with a correspondingMockUnit<T>.static SQLInsertssqlInserts()Returns aSQLInsertsobject that can be used to generate SQL Insertsjava.util.function.Supplier<SQLInsert>supplier()This is the sole abstract method of the interface.MockUnit<SQLTable>table(int numRows)Creates aMockUnit<SQLTable>, each table having a fixed number of rowsSQLInsertstableName(java.lang.String tableName)Sets the table name for which we are generating the SQLInserts.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.andreinc.mockneat.abstraction.MockUnit
array, array, collection, collection, collection, collection, collection, collection, consume, consume, get, get, list, list, list, list, list, list, map, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapToDouble, mapToInt, mapToLocalDate, mapToLong, mapToString, mapToString, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, serialize, set, set, set, set, set, set, stream, val, val, valStr, valStr
-
-
-
-
Constructor Detail
-
SQLInserts
protected SQLInserts()
-
SQLInserts
public SQLInserts(MockNeat mockNeat)
-
-
Method Detail
-
sqlInserts
public static SQLInserts sqlInserts()
Returns a
SQLInsertsobject that can be used to generate SQL Inserts- Returns:
- A new
SQLInsertsobject
-
tableName
public SQLInserts tableName(java.lang.String tableName)
Sets the table name for which we are generating the SQLInserts.
If this is not called, the default table name "some_table" will be used for the INSERTs.
- Parameters:
tableName- The table name- Returns:
- The same
SQLInsertsobject
-
column
public SQLInserts column(java.lang.String column, MockUnit<?> mockUnit)
Associates a column of the SQL table with a corresponding
MockUnit<T>- Parameters:
column- The column of the tablemockUnit- TheMockUnit<T>used to generate values for the column. The result is automatically transformed to String.- Returns:
- The same
SQLInsertsobject.
-
column
public SQLInserts column(java.lang.String column, MockUnit<?> mockUnit, java.util.function.Function<java.lang.String,java.lang.String> sqlFormatter)
Associates a column of the SQL table with a corresponding
MockUnit<T>.Before the value is generated from the
MockUnit<T>the @param sqlParameter function is applied to the values. This is useful when for example Strings have to be escaped for a given SQL dialect.- Parameters:
column- The column of the tablemockUnit- TheMockUnit<T>used to generate values for the column. The result is automatically transformed to String.sqlFormatter- TheFunction<String, String>for formatting the generated value- Returns:
- The same
SQLInsertsinstance.
-
column
public SQLInserts column(java.lang.String column, java.lang.String str)
Associates a column of the SQL table with a constant value.
- Parameters:
column- The column of the SQLTablestr- The constantStringvalue.- Returns:
- The same object
-
column
public SQLInserts column(java.lang.String column, java.lang.String str, java.util.function.Function<java.lang.String,java.lang.String> sqlFormatter)
Associates a column of the SQL table with a constant value.
Before the value is generated from the
MockUnit<T>the @param sqlParameter function is applied to the values. This is useful when for example Strings have to be escaped for a given SQL dialect.- Parameters:
column- The column of the SQLTablestr- The constantStringvalue.sqlFormatter- TheFunction<String, String>for formatting the constant value- Returns:
- The same
SQLInsertsobject.
-
supplier
public java.util.function.Supplier<SQLInsert> supplier()
Description copied from interface:MockUnitThis is the sole abstract method of the interface. Needs to be implemented every-time a MockUnit is implemented.
-
-