// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.25.0 // source: sessions.sql package db import ( "context" "github.com/jackc/pgx/v5/pgtype" ) const createSession = `-- name: CreateSession :one INSERT INTO user_sessions ( username, refresh_token, user_agent, client_ip, is_blocked, expires_at ) VALUES ( $1, $2, $3, $4, $5, $6 ) RETURNING id, index_id, username, refresh_token, user_agent, client_ip, is_blocked, expires_at, created_at ` type CreateSessionParams struct { Username string `json:"username"` RefreshToken string `json:"refresh_token"` UserAgent string `json:"user_agent"` ClientIp string `json:"client_ip"` IsBlocked bool `json:"is_blocked"` ExpiresAt pgtype.Timestamp `json:"expires_at"` } func (q *Queries) CreateSession(ctx context.Context, arg CreateSessionParams) (UserSession, error) { row := q.db.QueryRow(ctx, createSession, arg.Username, arg.RefreshToken, arg.UserAgent, arg.ClientIp, arg.IsBlocked, arg.ExpiresAt, ) var i UserSession err := row.Scan( &i.ID, &i.IndexID, &i.Username, &i.RefreshToken, &i.UserAgent, &i.ClientIp, &i.IsBlocked, &i.ExpiresAt, &i.CreatedAt, ) return i, err } const getSession = `-- name: GetSession :one SELECT id, index_id, username, refresh_token, user_agent, client_ip, is_blocked, expires_at, created_at FROM user_sessions WHERE id = $1 LIMIT 1 ` func (q *Queries) GetSession(ctx context.Context, id int32) (UserSession, error) { row := q.db.QueryRow(ctx, getSession, id) var i UserSession err := row.Scan( &i.ID, &i.IndexID, &i.Username, &i.RefreshToken, &i.UserAgent, &i.ClientIp, &i.IsBlocked, &i.ExpiresAt, &i.CreatedAt, ) return i, err }