naco-api/internal/store/UpsertStyleProfiles.sql.go
2025-12-02 19:33:03 +00:00

45 lines
1 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.30.0
// source: UpsertStyleProfiles.sql
package store
import (
"context"
"github.com/lib/pq"
)
const upsertStyleProfile = `-- name: UpsertStyleProfile :exec
INSERT INTO user_style_profiles (user_id, platform, embedding, top_keywords, style_summary, post_count)
VALUES ($1, $2, $3, $4, $5, $6)
ON CONFLICT (user_id, platform)
DO UPDATE SET
embedding = EXCLUDED.embedding,
top_keywords = EXCLUDED.top_keywords,
style_summary = EXCLUDED.style_summary,
post_count = EXCLUDED.post_count,
updated_at = NOW()
`
type UpsertStyleProfileParams struct {
UserID string
Platform string
Embedding interface{}
TopKeywords []string
StyleSummary string
PostCount int32
}
func (q *Queries) UpsertStyleProfile(ctx context.Context, arg UpsertStyleProfileParams) error {
_, err := q.db.ExecContext(ctx, upsertStyleProfile,
arg.UserID,
arg.Platform,
arg.Embedding,
pq.Array(arg.TopKeywords),
arg.StyleSummary,
arg.PostCount,
)
return err
}