PostgresSchema { public static void insert(final QueryStatement statement, final CollectionName collection) throws QueryBuildException { try { Writer body = statement.getBodyWriter(); body.write("INSERT INTO "); body.write(collection.toString()); body.write(" ("); body.write(DOCUMENT_COLUMN); body.write(") VALUES (?::jsonb)"); } catch (IOException e) { throw new QueryBuildException("Failed to build insert body", e); } } private  PostgresSchema(); static void create(final QueryStatement statement, final CollectionName collection, final IObject options); static FieldPath getIdFieldPath(final CollectionName collection); static void insert(final QueryStatement statement, final CollectionName collection); static void update(final QueryStatement statement, final CollectionName collection); static void getById(final QueryStatement statement, final CollectionName collection); static void search(final QueryStatement statement, final CollectionName collection, final IObject criteria); static void delete(final QueryStatement statement, final CollectionName collection); static void count(final QueryStatement statement, final CollectionName collection, final IObject criteria); static final String DOCUMENT_COLUMN; static final String FULLTEXT_COLUMN; static final String ID_FIELD_PATTERN; static final String FTS_DICTIONARY; static final int DEFAULT_PAGE_SIZE; }
@Test public void testInsert() throws QueryBuildException { PostgresSchema.insert(statement, collection); assertEquals("INSERT INTO test_collection (document) " + "VALUES (?::jsonb)", body.toString()); }