<commit_before>package main

import (
	"encoding/csv"
	"fmt"
	"log"
	"net/http"
	"os"
	"strconv"
	"time"

	"github.com/StephanDollberg/go-json-rest-middleware-jwt"
	"github.com/ant0ine/go-json-rest/rest"
	"github.com/jinzhu/gorm"
	_ "github.com/lib/pq"
)

// Book ...
type Book struct {
	ID          int64      `json:"id"`
	Name        string     `sql:"size:1024" json:"name"`
	Author      string     `sql:"size:512" json:"author"`
	Translator  string     `sql:"size:512" json:"translator"`
	Pages       int64      `json:"pages"`
	Publisher   string     `sql:"size:256" json:"publisher"`
	Language    string     `sql:"size:128" json:"language"`
	Description string     `sql:"size:" json:"description"`
	Quantity    int        `json:"quantity"`
	Owner       User       `json:"owner"`
	OwnerID     int        `json:"owner"`
	Borrowers   []User     `gorm:"many2many:book_borrowers" sql:"size:1024" json:"borrowers"`
	PublishedAt time.Time  `json:"publishedAt"`
	CreatedAt   time.Time  `json:"createdAt"`
	UpdatedAt   time.Time  `json:"updatedAt"`
	DeletedAt   *time.Time `json:"-"`
	// Review    int64      `json:"review"`
	// Rank      string     `sql:"size:1024" json:"rank"`
}

// User ...
type User struct {
	ID        int64      `json:"id"`
	CreatedAt time.Time  `json:"createdAt"`
	UpdatedAt time.Time  `json:"updatedAt"`
	DeletedAt *time.Time `json:"-"`
	Name      string
	Password  string `json:"-"`
	Email     string
}

// BorrowRecord ...
type BorrowRecord struct {
	ID        int64      `json:"id"`
	CreatedAt time.Time  `json:"createdAt"`
	UpdatedAt time.Time  `json:"updatedAt"`
	DeletedAt *time.Time `json:"-"`
	StartAt   time.Time  `json:"startAt"`
	EndAt     time.Time  `json:"endAt"`
	Book      Book       `json:"book"`
	BookID    int64      `json:"bookID"`
	User      User       `json:"user"`
	UserID    int        `json:"userID"`
	Status    string     `sql:"size:128" json:"status"`
}

// Impl ...
type Impl struct {
	DB *gorm.DB
}

// InitDB ...
func (i *Impl) InitDB() {
	var err error
	i.DB, err = gorm.Open("postgres", "postgresql://postgres:123456Pg@localhost:5432/postgres?sslmode=disable")
	if err != nil {
		log.Fatalf("Got error when connect database, the error is '%v'", err)
	}
	i.DB.LogMode(true)<commit_msg>should use lowercase in json<commit_after>package main

import (
	"encoding/csv"
	"fmt"
	"log"
	"net/http"
	"os"
	"strconv"
	"time"

	"github.com/StephanDollberg/go-json-rest-middleware-jwt"
	"github.com/ant0ine/go-json-rest/rest"
	"github.com/jinzhu/gorm"
	_ "github.com/lib/pq"
)

// Book ...
type Book struct {
	ID          int64      `json:"id"`
	Name        string     `sql:"size:1024" json:"name"`
	Author      string     `sql:"size:512" json:"author"`
	Translator  string     `sql:"size:512" json:"translator"`
	Pages       int64      `json:"pages"`
	Publisher   string     `sql:"size:256" json:"publisher"`
	Language    string     `sql:"size:128" json:"language"`
	Description string     `sql:"size:" json:"description"`
	Quantity    int        `json:"quantity"`
	Owner       User       `json:"owner"`
	OwnerID     int        `json:"owner"`
	Borrowers   []User     `gorm:"many2many:book_borrowers" sql:"size:1024" json:"borrowers"`
	PublishedAt time.Time  `json:"publishedAt"`
	CreatedAt   time.Time  `json:"createdAt"`
	UpdatedAt   time.Time  `json:"updatedAt"`
	DeletedAt   *time.Time `json:"-"`
	// Review    int64      `json:"review"`
	// Rank      string     `sql:"size:1024" json:"rank"`
}

// User ...
type User struct {
	ID        int64      `json:"id"`
	CreatedAt time.Time  `json:"createdAt"`
	UpdatedAt time.Time  `json:"updatedAt"`
	DeletedAt *time.Time `json:"-"`
	Name      string		 `json:"name"`
	Password  string 		 `json:"-"`
	Email     string		 `json:"email"`
}

// BorrowRecord ...
type BorrowRecord struct {
	ID        int64      `json:"id"`
	CreatedAt time.Time  `json:"createdAt"`
	UpdatedAt time.Time  `json:"updatedAt"`
	DeletedAt *time.Time `json:"-"`
	StartAt   time.Time  `json:"startAt"`
	EndAt     time.Time  `json:"endAt"`
	Book      Book       `json:"book"`
	BookID    int64      `json:"bookID"`
	User      User       `json:"user"`
	UserID    int        `json:"userID"`
	Status    string     `sql:"size:128" json:"status"`
}

// Impl ...
type Impl struct {
	DB *gorm.DB
}

// InitDB ...
func (i *Impl) InitDB() {
	var err error
	i.DB, err = gorm.Open("postgres", "postgresql://postgres:123456Pg@localhost:5432/postgres?sslmode=disable")
	if err != nil {
		log.Fatalf("Got error when connect database, the error is '%v'", err)
	}
	i.DB.LogMode(true)
{'fraction_non_alphanumeric': 0.16228167145699757, 'fraction_numerical': 0.02255140393544108, 'mean_word_length': 2.968421052631579, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2379352', 'n_tokens_mistral': 1703, 'n_tokens_neox': 1628, 'n_words': 353}