Add migrations and model go struct
parent
9d8914bf26
commit
1524ebced8
|
@ -7,4 +7,4 @@ log_level: "debug"
|
|||
|
||||
# db
|
||||
DB:
|
||||
baseurlbd: "host=localhost user=tester dbname=testdb sslmode=disable"
|
||||
baseurlbd: "host=localhost user=admin password=root dbname=postgres sslmode=disable"
|
|
@ -0,0 +1,12 @@
|
|||
version: '3.5'
|
||||
|
||||
services:
|
||||
database:
|
||||
container_name: postgres
|
||||
ports:
|
||||
- "5432:5432"
|
||||
environment:
|
||||
- POSTGRES_PASSWORD=root
|
||||
- POSTGRES_USER=admin
|
||||
image: postgres
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package model
|
||||
|
||||
type Films struct {
|
||||
id int
|
||||
ru_title string
|
||||
orig_title string
|
||||
imdb_id string
|
||||
kinopoisk_id string
|
||||
posterUrl string
|
||||
posterUrlPreview string
|
||||
countries string
|
||||
genres map[string]interface{}
|
||||
year int
|
||||
description string
|
||||
ratingKinopoisk int
|
||||
ratingImdb int
|
||||
iframe_src string
|
||||
ratingImdbVoteCount int
|
||||
ratingKinopoiskVoteCount int
|
||||
media map[string]interface{}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package repositoryes
|
||||
|
||||
import (
|
||||
"git.ukamnya.ru/stulyaganov/RestApi/internal/bd"
|
||||
"git.ukamnya.ru/stulyaganov/RestApi/internal/bd/model"
|
||||
)
|
||||
|
||||
type Filmsrepo struct {
|
||||
DB *bd.Bd
|
||||
}
|
||||
|
||||
func Create(model.Films) (*model.Films, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func FindDyId(id int) (*model.Films, error) {
|
||||
return nil, nil
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
DROP TABLE films;
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
CREATE TABLE films (
|
||||
id INTEGER NOT NULL,
|
||||
ru_title VARCHAR(256),
|
||||
orig_title VARCHAR(255),
|
||||
imdb_id VARCHAR(255),
|
||||
kinopoisk_id INTEGER,
|
||||
posterUrl VARCHAR(1500),
|
||||
posterUrlPreview VARCHAR(1500),
|
||||
countries JSON,
|
||||
genres JSON,
|
||||
year INTEGER,
|
||||
description VARCHAR(20000),
|
||||
ratingKinopoisk INTEGER,
|
||||
ratingImdb INTEGER,
|
||||
iframe_src VARCHAR(2000),
|
||||
ratingImdbVoteCount INTEGER,
|
||||
ratingKinopoiskVoteCount INTEGER,
|
||||
media JSON,
|
||||
PRIMARY KEY(id)
|
||||
);
|
Loading…
Reference in New Issue