var user models.User
query := fmt.Sprintf("SELECT id FROM users WHERE username='%s'", username)
err := storage.DB.QueryRow(query).Scan(&user.Id)
if err != nil {
return nil, errors.New("couldn't find user in database")
}
Robert';DROP TABLE users--
f0fdde665f98 postgres "docker-entrypoint.s…" 2 hours ago Up 37 minutes 0.0.0.0:5432->5432/tcp pqtestpostgres
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f0fdde665f98 postgres "docker-entrypoint.s…" 2 hours ago Up 37 minutes 0.0.0.0:5432->5432/tcp pqtestpostgres
CONNECTIONS AND AUTHENTICATION #------------------------------------------------------------------------------ # - Connection Settings - listen_addresses = '*' # comma-separated list of addresses; # defaults to 'localhost'; use '*' for all # (change requires restart) #port = 5432 # (change requires restart) max_connections = 100 # (change requires restart) #superuser_reserved_connections = 3 # (change requires restart) #unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories
pqgotest=# SELECT * FROM pg_settings WHERE name = 'port'; name | setting | unit | category | short_desc | extra_desc | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | sourcefile | sourceline | pending_restart ------+---------+------+------------------------------------------------------+------------------------------------------+------------+------------+---------+---------+---------+---------+----------+----------+-----------+------------+------------+----------------- port | 5432 | | Connections and Authentication / Connection Settings | Sets the TCP port the server listens on. | | postmaster | integer | default | 1 | 65535 | | 5432 | 5432 | | | f (1 row)
(*w).Header().Set(
) вместо w.Header().Set()
- такой вариант решения первоначальной проблемы нашел и он у меня сразу заработал с остальными методами. increment
и decrement
убрал вызов функции likesById(likes)
и добавил хук useEffectuseEffect( () => {
likesById(likes)
},[likes])
setLikes()
, которая и изменяет likes, должна отработать первой, как я понимаю, а потом уже измененные likes передаются в фукнцию likesById(likes)
, или нет?
Да, работаю удаленно