Something went wrong. Try again.
the coolest token pot ever
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899// Code generated by sqlc. DO NOT EDIT.// versions:// sqlc v1.31.1// source: user_memory.sql
package store
import ( "context")
const deleteUserMemoryKey = `-- name: DeleteUserMemoryKey :execDELETE FROM user_memory WHERE user_id = ? AND key = ?`
type DeleteUserMemoryKeyParams struct { UserID string `json:"user_id"` Key string `json:"key"`}
func (q *Queries) DeleteUserMemoryKey(ctx context.Context, arg DeleteUserMemoryKeyParams) error { _, err := q.db.ExecContext(ctx, deleteUserMemoryKey, arg.UserID, arg.Key) return err}
const getUserMemory = `-- name: GetUserMemory :manySELECT user_id, "key", value, created_at, updated_at FROM user_memory WHERE user_id = ? ORDER BY key`
func (q *Queries) GetUserMemory(ctx context.Context, userID string) ([]UserMemory, error) { rows, err := q.db.QueryContext(ctx, getUserMemory, userID) if err != nil { return nil, err } defer rows.Close() items := []UserMemory{} for rows.Next() { var i UserMemory if err := rows.Scan( &i.UserID, &i.Key, &i.Value, &i.CreatedAt, &i.UpdatedAt, ); err != nil { return nil, err } items = append(items, i) } if err := rows.Close(); err != nil { return nil, err } if err := rows.Err(); err != nil { return nil, err } return items, nil}
const getUserMemoryKey = `-- name: GetUserMemoryKey :oneSELECT user_id, "key", value, created_at, updated_at FROM user_memory WHERE user_id = ? AND key = ?`
type GetUserMemoryKeyParams struct { UserID string `json:"user_id"` Key string `json:"key"`}
func (q *Queries) GetUserMemoryKey(ctx context.Context, arg GetUserMemoryKeyParams) (UserMemory, error) { row := q.db.QueryRowContext(ctx, getUserMemoryKey, arg.UserID, arg.Key) var i UserMemory err := row.Scan( &i.UserID, &i.Key, &i.Value, &i.CreatedAt, &i.UpdatedAt, ) return i, err}
const upsertUserMemory = `-- name: UpsertUserMemory :execINSERT INTO user_memory (user_id, key, value, created_at, updated_at)VALUES (?, ?, ?, unixepoch(), unixepoch())ON CONFLICT(user_id, key) DO UPDATE SET value = excluded.value, updated_at = unixepoch()`
type UpsertUserMemoryParams struct { UserID string `json:"user_id"` Key string `json:"key"` Value string `json:"value"`}
func (q *Queries) UpsertUserMemory(ctx context.Context, arg UpsertUserMemoryParams) error { _, err := q.db.ExecContext(ctx, upsertUserMemory, arg.UserID, arg.Key, arg.Value) return err}