Answer of stockbit coding test
Answer for this question can is
SELECT u.id, u.user_name, p.user_name AS parent_user_name
FROM users u
LEFT JOIN users p NO p.id = u.parent
or you can access on this file
This answer can access on second_answer folder. this project contain 2 services, client and server. steps to run this project is :
- after clone stockbit repo, change your directory to
second_answer/movie/server
. - build this project using command
go build
- after success build binary for this project run binary
./server
(for unix)
- after clone stockbit repo, change your directory to
second_answer/movie/client
. - build this project using command
go build
- after success build binary for this project run binary
./client
(for unix). make sure server running - this client have 2 endpoints,
/v1/movies
and/v1/movie/{movie_id}
. - endpoint
/v1/movies
need 2 parameters,s
for search word andpage
for page. - this sample for full endpoint
http://localhost:8080/v1/movies?s=batman&page=1
- for movie detail endpoint you can get id from movies endpoint.
- this sample for full endpoint
http://localhost:8080/v1/movie/tt0372784
this answer can access on third_answer folder.
to run this project, change directory to third_answer
. build this project with command go build
.
run binary ./third_answer
(for unix).
this answer can access on fourth_answer folder.
to run this project, change directory to fourth_answer
. build this project with command go build
.
run binary ./fourth_answer
(for unix).