<commit_before>package com.bls.patronage.db.dao;

import com.bls.patronage.db.model.Deck;
import com.bls.patronage.db.model.DeckWithFlashcardsNumber;
import org.skife.jdbi.v2.sqlobject.Bind;
import org.skife.jdbi.v2.sqlobject.BindBean;
import org.skife.jdbi.v2.sqlobject.SqlQuery;
import org.skife.jdbi.v2.sqlobject.SqlUpdate;
import org.skife.jdbi.v2.sqlobject.customizers.RegisterMapper;

import java.util.List;
import java.util.UUID;

@RegisterMapper(DeckMapper.class)
public interface DeckDAO {

    @SqlQuery("select id, name, public from decks where id = :id")
    Deck getDeckById(@Bind("id") UUID id);

    @SqlQuery("select id, name, public from decks")
    List<Deck> getAllDecks();

    @RegisterMapper(DeckWithFlashcardsNumberMapper.class)
    @SqlQuery("select decks.id, decks.name, decks.public, count(flashcards.question) " +
            "from decks\n" +
            "left join flashcards\n" +
            "on decks.id = flashcards.deckid " +
            "group by decks.id")<commit_msg>dao updated<commit_after>package com.bls.patronage.db.dao;

import com.bls.patronage.db.model.Deck;
import com.bls.patronage.db.model.DeckWithFlashcardsNumber;
import org.skife.jdbi.v2.sqlobject.Bind;
import org.skife.jdbi.v2.sqlobject.BindBean;
import org.skife.jdbi.v2.sqlobject.SqlQuery;
import org.skife.jdbi.v2.sqlobject.SqlUpdate;
import org.skife.jdbi.v2.sqlobject.customizers.RegisterMapper;

import java.util.List;
import java.util.UUID;

@RegisterMapper(DeckMapper.class)
public interface DeckDAO {

    @SqlQuery("select id, name, public from decks where id = :id")
    Deck getDeckById(@Bind("id") UUID id);

    @SqlQuery("select id, name, public from decks")
    List<Deck> getAllDecks();

    @RegisterMapper(DeckWithFlashcardsNumberMapper.class)
    @SqlQuery("select decks.id, decks.name, decks.public, count(flashcards.question) as count " +
            "from decks\n" +
            "left join flashcards\n" +
            "on decks.id = flashcards.deckid " +
            "group by decks.id")
{'fraction_non_alphanumeric': 0.12630532073595227, 'fraction_numerical': 0.004972650422675286, 'mean_word_length': 3.9073170731707316, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3226502', 'n_tokens_mistral': 738, 'n_tokens_neox': 706, 'n_words': 126}