All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.instaclustr.sstable.generator.RowMapper1 Maven / Gradle / Ivy

There is a newer version: 1.5
Show newest version
package com.instaclustr.sstable.generator;

import static java.lang.String.format;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.function.Supplier;
import java.util.stream.Stream;

public class RowMapper1 implements RowMapper {

    public static final String KEYSPACE = "test";
    public static final String TABLE = "test";

    @Override
    public List map(final List row) {
        return null;
    }

    @Override
    public Stream> get() {
        return Stream.generate((Supplier>) () -> new ArrayList() {{
            add(UUID.randomUUID());
            add(UUID.randomUUID().toString());
            add(UUID.randomUUID().toString());
            add(UUID.randomUUID().toString());
            add(UUID.randomUUID().toString());
        }}).limit(10);
    }

    @Override
    public List random() {
        return new ArrayList() {{
            add(UUID.randomUUID());
            add(UUID.randomUUID().toString());
            add(UUID.randomUUID().toString());
            add(UUID.randomUUID().toString());
            add(UUID.randomUUID().toString());
        }};
    }

    @Override
    public String insertStatement() {
        return format("INSERT INTO %s.%s (id, name, surname, description, profession) VALUES (?, ?, ?, ?, ?);", KEYSPACE, TABLE);
    }
}