Archived
1

Refactoring: now we respect gofmt and have some comments

This commit is contained in:
2017-10-18 09:39:50 +04:00
parent 6f374e560e
commit 8dab6c0699
47 changed files with 607 additions and 479 deletions

18
lib/dbmapping/chats.go Normal file
View File

@@ -0,0 +1,18 @@
// i2_bot Instinct PokememBro Bot
// Copyright (c) 2017 Vladimir "fat0troll" Hodakov
package dbmapping
import (
// stdlib
"time"
)
// Chat is a struct, which represents `chats` table item in databse.
type Chat struct {
ID int `db:"id"`
Name string `db:"name"`
ChatType bool `db:"chat_type"`
TelegramID int `db:"telegram_id"`
CreatedAt *time.Time `db:"created_at"`
}

View File

@@ -8,10 +8,11 @@ import (
"time"
)
// Element is a struct, which represents `elements` table item in databse.
type Element struct {
Id int `db:"id"`
Symbol string `db:"symbol"`
Name string `db:"name"`
League_id int `db:"league_id"`
Created_at *time.Time `db:"created_at"`
ID int `db:"id"`
Symbol string `db:"symbol"`
Name string `db:"name"`
LeagueID int `db:"league_id"`
CreatedAt *time.Time `db:"created_at"`
}

View File

@@ -8,9 +8,10 @@ import (
"time"
)
// League is a struct, which represents `leagues` table item in databse.
type League struct {
Id int `db:"id"`
Symbol string `db:"symbol"`
Name string `db:"name"`
Created_at *time.Time `db:"created_at"`
ID int `db:"id"`
Symbol string `db:"symbol"`
Name string `db:"name"`
CreatedAt *time.Time `db:"created_at"`
}

View File

@@ -8,9 +8,10 @@ import (
"time"
)
// Level is a struct, which represents `levels` table item in databse.
type Level struct {
Id int `db:"id"`
Max_exp int `db:"max_exp"`
Max_egg int `db:"max_egg"`
Created_at time.Time `db:"created_at"`
ID int `db:"id"`
MaxExp int `db:"max_exp"`
MaxEgg int `db:"max_egg"`
CreatedAt time.Time `db:"created_at"`
}

View File

@@ -8,9 +8,10 @@ import (
"time"
)
// Location is a struct, which represents `locations` table item in databse.
type Location struct {
Id int `db:"id"`
Symbol string `db:"symbol"`
Name string `db:"name"`
Created_at time.Time `db:"created_at"`
ID int `db:"id"`
Symbol string `db:"symbol"`
Name string `db:"name"`
CreatedAt time.Time `db:"created_at"`
}

View File

@@ -8,12 +8,13 @@ import (
"time"
)
// Player is a struct, which represents `players` table item in databse.
type Player struct {
Id int `db:"id"`
Telegram_id int `db:"telegram_id"`
League_id int `db:"league_id"`
Squad_id int `db:"squad_id"`
Status string `db:"status"`
Created_at time.Time `db:"created_at"`
Updated_at time.Time `db:"updated_at"`
ID int `db:"id"`
TelegramID int `db:"telegram_id"`
LeagueID int `db:"league_id"`
SquadID int `db:"squad_id"`
Status string `db:"status"`
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`
}

View File

@@ -8,8 +8,9 @@ import (
"time"
)
// Pokememe is a struct, which represents `pokememes` table item in databse.
type Pokememe struct {
Id int `db:"id"`
ID int `db:"id"`
Grade int `db:"grade"`
Name string `db:"name"`
Description string `db:"description"`
@@ -19,13 +20,12 @@ type Pokememe struct {
Defence int `db:"defence"`
Price int `db:"price"`
Purchaseable bool `db:"purchaseable"`
Image_url string `db:"image_url"`
Player_id int `db:"player_id"`
Created_at time.Time `db:"created_at"`
ImageURL string `db:"image_url"`
PlayerID int `db:"player_id"`
CreatedAt time.Time `db:"created_at"`
}
// Type for handling pokememe with all informations about locations and elements
// PokememeFull is a struct for handling pokememe with all informations about locations and elements
type PokememeFull struct {
Pokememe Pokememe
Locations []Location

View File

@@ -8,9 +8,10 @@ import (
"time"
)
// PokememeElement is a struct, which represents `pokememes_elements` table item in databse.
type PokememeElement struct {
Id int `db:"id"`
Pokememe_id int `db:"pokememe_id"`
Element_id int `db:"element_id"`
Created_at time.Time `db:"created_at"`
ID int `db:"id"`
PokememeID int `db:"pokememe_id"`
ElementID int `db:"element_id"`
CreatedAt time.Time `db:"created_at"`
}

View File

@@ -8,9 +8,10 @@ import (
"time"
)
// PokememeLocation is a struct, which represents `pokememes_locations` table item in databse.
type PokememeLocation struct {
Id int `db:"id"`
Pokememe_id int `db:"pokememe_id"`
Location_id int `db:"location_id"`
Created_at time.Time `db:"created_at"`
ID int `db:"id"`
PokememeID int `db:"pokememe_id"`
LocationID int `db:"location_id"`
CreatedAt time.Time `db:"created_at"`
}

View File

@@ -8,18 +8,19 @@ import (
"time"
)
// Profile is a struct, which represents `profiles` table item in databse.
type Profile struct {
Id int `db:"id"`
Player_id int `db:"player_id"`
ID int `db:"id"`
PlayerID int `db:"player_id"`
Nickname string `db:"nickname"`
TelegramNickname string `db:"telegram_nickname"`
Level_id int `db:"level_id"`
LevelID int `db:"level_id"`
Pokeballs int `db:"pokeballs"`
Wealth int `db:"wealth"`
Exp int `db:"exp"`
Egg_exp int `db:"egg_exp"`
EggExp int `db:"egg_exp"`
Power int `db:"power"`
Weapon_id int `db:"weapon_id"`
WeaponID int `db:"weapon_id"`
Crystalls int `db:"crystalls"`
Created_at time.Time `db:"created_at"`
CreatedAt time.Time `db:"created_at"`
}

View File

@@ -8,11 +8,12 @@ import (
"time"
)
// ProfilePokememe is a struct, which represents `profiles_pokememes` table item in databse.
type ProfilePokememe struct {
Id int `db:"id"`
Profile_id int `db:"profile_id"`
Pokememe_id int `db:"pokememe_id"`
Pokememe_lvl int `db:"pokememe_lvl"`
Pokememe_rarity string `db:"pokememe_rarity"`
Created_at time.Time `db:"created_at"`
ID int `db:"id"`
ProfileID int `db:"profile_id"`
PokememeID int `db:"pokememe_id"`
PokememeLevel int `db:"pokememe_lvl"`
PokememeRarity string `db:"pokememe_rarity"`
CreatedAt time.Time `db:"created_at"`
}

View File

@@ -8,10 +8,11 @@ import (
"time"
)
// Weapon is a struct, which represents `weapons` table item in databse.
type Weapon struct {
Id int `db:"id"`
Name string `db:"name"`
Power int `db:"power"`
Price int `db:"price"`
Created_at time.Time `db:"created_at"`
ID int `db:"id"`
Name string `db:"name"`
Power int `db:"power"`
Price int `db:"price"`
CreatedAt time.Time `db:"created_at"`
}