558 lines
18 KiB
Go
558 lines
18 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.30.0
|
|
// source: affiliates.sql
|
|
|
|
package dbgen
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
const AffiliateApply = `-- name: AffiliateApply :one
|
|
SELECT affiliate_apply($1::bigint,$2::text)::bigint AS user_id
|
|
`
|
|
|
|
type AffiliateApplyParams struct {
|
|
UserID int64 `json:"user_id"`
|
|
Application string `json:"application"`
|
|
}
|
|
|
|
func (q *Queries) AffiliateApply(ctx context.Context, arg AffiliateApplyParams) (int64, error) {
|
|
row := q.db.QueryRow(ctx, AffiliateApply, arg.UserID, arg.Application)
|
|
var user_id int64
|
|
err := row.Scan(&user_id)
|
|
return user_id, err
|
|
}
|
|
|
|
const AffiliateBalances = `-- name: AffiliateBalances :many
|
|
WITH earnings AS (
|
|
SELECT c.currency,
|
|
SUM(CASE WHEN c.reversed_at IS NULL AND c.payout_id IS NULL AND c.available_at>now() THEN c.amount ELSE 0 END) AS pending,
|
|
SUM(CASE WHEN c.reversed_at IS NULL AND c.payout_id IS NULL AND c.available_at<=now() THEN c.amount ELSE 0 END) AS available,
|
|
SUM(CASE WHEN c.reversed_at IS NOT NULL THEN c.amount ELSE 0 END) AS reversed,
|
|
SUM(CASE WHEN c.reversed_at IS NOT NULL AND c.recovery_payout_id IS NULL AND p.status='PAID' THEN c.amount ELSE 0 END) AS debt
|
|
FROM referral_commissions c LEFT JOIN affiliate_payouts p ON p.id=c.payout_id WHERE c.referrer_id=$1 GROUP BY c.currency
|
|
), payouts AS (
|
|
SELECT currency,SUM(CASE WHEN status='REQUESTED' THEN amount ELSE 0 END) AS reserved,SUM(CASE WHEN status='PAID' THEN amount ELSE 0 END) AS paid FROM affiliate_payouts WHERE user_id=$1 GROUP BY currency
|
|
)
|
|
SELECT e.currency,e.pending::text AS pending,(e.available-e.debt)::text AS available,e.reversed::text AS reversed,e.debt::text AS recovery_due,
|
|
COALESCE(p.reserved,0)::text AS reserved,COALESCE(p.paid,0)::text AS paid
|
|
FROM earnings e LEFT JOIN payouts p ON p.currency=e.currency ORDER BY e.currency
|
|
`
|
|
|
|
type AffiliateBalancesRow struct {
|
|
Currency string `json:"currency"`
|
|
Pending string `json:"pending"`
|
|
Available string `json:"available"`
|
|
Reversed string `json:"reversed"`
|
|
RecoveryDue string `json:"recovery_due"`
|
|
Reserved string `json:"reserved"`
|
|
Paid string `json:"paid"`
|
|
}
|
|
|
|
func (q *Queries) AffiliateBalances(ctx context.Context, referrerID int64) ([]AffiliateBalancesRow, error) {
|
|
rows, err := q.db.Query(ctx, AffiliateBalances, referrerID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
var items []AffiliateBalancesRow
|
|
for rows.Next() {
|
|
var i AffiliateBalancesRow
|
|
if err := rows.Scan(
|
|
&i.Currency,
|
|
&i.Pending,
|
|
&i.Available,
|
|
&i.Reversed,
|
|
&i.RecoveryDue,
|
|
&i.Reserved,
|
|
&i.Paid,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const AffiliateCommissionCount = `-- name: AffiliateCommissionCount :one
|
|
SELECT COUNT(*) FROM referral_commissions WHERE ($1::bigint=0 OR referrer_id=$1)
|
|
`
|
|
|
|
func (q *Queries) AffiliateCommissionCount(ctx context.Context, userID int64) (int64, error) {
|
|
row := q.db.QueryRow(ctx, AffiliateCommissionCount, userID)
|
|
var count int64
|
|
err := row.Scan(&count)
|
|
return count, err
|
|
}
|
|
|
|
const AffiliateCommissions = `-- name: AffiliateCommissions :many
|
|
SELECT c.id,c.referrer_id,c.payment_id,c.course_id,c.commission_percent::text AS commission_percent,c.amount::text AS amount,c.currency,c.created_at,c.available_at,c.reversed_at,c.reversal_reason,c.payout_id,
|
|
(CASE WHEN c.reversed_at IS NOT NULL THEN 'REVERSED' WHEN p.status='PAID' THEN 'PAID' WHEN p.status='REQUESTED' THEN 'RESERVED' WHEN c.available_at>now() THEN 'PENDING' ELSE 'AVAILABLE' END)::text AS status
|
|
FROM referral_commissions c LEFT JOIN affiliate_payouts p ON p.id=c.payout_id
|
|
WHERE ($1::bigint=0 OR c.referrer_id=$1)
|
|
ORDER BY c.created_at DESC,c.id DESC LIMIT $3::int OFFSET $2::int
|
|
`
|
|
|
|
type AffiliateCommissionsParams struct {
|
|
UserID int64 `json:"user_id"`
|
|
PageOffset int32 `json:"page_offset"`
|
|
PageLimit int32 `json:"page_limit"`
|
|
}
|
|
|
|
type AffiliateCommissionsRow struct {
|
|
ID int64 `json:"id"`
|
|
ReferrerID int64 `json:"referrer_id"`
|
|
PaymentID int64 `json:"payment_id"`
|
|
CourseID pgtype.Int8 `json:"course_id"`
|
|
CommissionPercent string `json:"commission_percent"`
|
|
Amount string `json:"amount"`
|
|
Currency string `json:"currency"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
AvailableAt pgtype.Timestamptz `json:"available_at"`
|
|
ReversedAt pgtype.Timestamptz `json:"reversed_at"`
|
|
ReversalReason pgtype.Text `json:"reversal_reason"`
|
|
PayoutID pgtype.Int8 `json:"payout_id"`
|
|
Status string `json:"status"`
|
|
}
|
|
|
|
func (q *Queries) AffiliateCommissions(ctx context.Context, arg AffiliateCommissionsParams) ([]AffiliateCommissionsRow, error) {
|
|
rows, err := q.db.Query(ctx, AffiliateCommissions, arg.UserID, arg.PageOffset, arg.PageLimit)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
var items []AffiliateCommissionsRow
|
|
for rows.Next() {
|
|
var i AffiliateCommissionsRow
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.ReferrerID,
|
|
&i.PaymentID,
|
|
&i.CourseID,
|
|
&i.CommissionPercent,
|
|
&i.Amount,
|
|
&i.Currency,
|
|
&i.CreatedAt,
|
|
&i.AvailableAt,
|
|
&i.ReversedAt,
|
|
&i.ReversalReason,
|
|
&i.PayoutID,
|
|
&i.Status,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const AffiliateCount = `-- name: AffiliateCount :one
|
|
SELECT COUNT(*) FROM affiliates WHERE ($1::text='' OR status=$1)
|
|
`
|
|
|
|
func (q *Queries) AffiliateCount(ctx context.Context, status string) (int64, error) {
|
|
row := q.db.QueryRow(ctx, AffiliateCount, status)
|
|
var count int64
|
|
err := row.Scan(&count)
|
|
return count, err
|
|
}
|
|
|
|
const AffiliateEvents = `-- name: AffiliateEvents :many
|
|
SELECT id,affiliate_user_id,actor_id,event,details,created_at FROM affiliate_events
|
|
WHERE ($1::bigint=0 OR affiliate_user_id=$1) ORDER BY id DESC LIMIT $3::int OFFSET $2::int
|
|
`
|
|
|
|
type AffiliateEventsParams struct {
|
|
UserID int64 `json:"user_id"`
|
|
PageOffset int32 `json:"page_offset"`
|
|
PageLimit int32 `json:"page_limit"`
|
|
}
|
|
|
|
func (q *Queries) AffiliateEvents(ctx context.Context, arg AffiliateEventsParams) ([]AffiliateEvent, error) {
|
|
rows, err := q.db.Query(ctx, AffiliateEvents, arg.UserID, arg.PageOffset, arg.PageLimit)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
var items []AffiliateEvent
|
|
for rows.Next() {
|
|
var i AffiliateEvent
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.AffiliateUserID,
|
|
&i.ActorID,
|
|
&i.Event,
|
|
&i.Details,
|
|
&i.CreatedAt,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const AffiliateList = `-- name: AffiliateList :many
|
|
SELECT a.user_id, a.status, a.application, a.terms_accepted_at, a.terms_version, a.reviewed_by, a.review_note, a.created_at, a.updated_at,u.email,u.first_name,u.last_name,COALESCE(rc.code,'')::text AS code
|
|
FROM affiliates a JOIN users u ON u.id=a.user_id LEFT JOIN referral_codes rc ON rc.user_id=a.user_id
|
|
WHERE ($1::text='' OR a.status=$1)
|
|
ORDER BY a.created_at DESC,a.user_id DESC LIMIT $3::int OFFSET $2::int
|
|
`
|
|
|
|
type AffiliateListParams struct {
|
|
Status string `json:"status"`
|
|
PageOffset int32 `json:"page_offset"`
|
|
PageLimit int32 `json:"page_limit"`
|
|
}
|
|
|
|
type AffiliateListRow struct {
|
|
UserID int64 `json:"user_id"`
|
|
Status string `json:"status"`
|
|
Application string `json:"application"`
|
|
TermsAcceptedAt pgtype.Timestamptz `json:"terms_accepted_at"`
|
|
TermsVersion string `json:"terms_version"`
|
|
ReviewedBy pgtype.Int8 `json:"reviewed_by"`
|
|
ReviewNote string `json:"review_note"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
Email pgtype.Text `json:"email"`
|
|
FirstName pgtype.Text `json:"first_name"`
|
|
LastName pgtype.Text `json:"last_name"`
|
|
Code string `json:"code"`
|
|
}
|
|
|
|
func (q *Queries) AffiliateList(ctx context.Context, arg AffiliateListParams) ([]AffiliateListRow, error) {
|
|
rows, err := q.db.Query(ctx, AffiliateList, arg.Status, arg.PageOffset, arg.PageLimit)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
var items []AffiliateListRow
|
|
for rows.Next() {
|
|
var i AffiliateListRow
|
|
if err := rows.Scan(
|
|
&i.UserID,
|
|
&i.Status,
|
|
&i.Application,
|
|
&i.TermsAcceptedAt,
|
|
&i.TermsVersion,
|
|
&i.ReviewedBy,
|
|
&i.ReviewNote,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Email,
|
|
&i.FirstName,
|
|
&i.LastName,
|
|
&i.Code,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const AffiliatePayoutCount = `-- name: AffiliatePayoutCount :one
|
|
SELECT COUNT(*) FROM affiliate_payouts WHERE ($1::bigint=0 OR user_id=$1) AND ($2::text='' OR status=$2)
|
|
`
|
|
|
|
type AffiliatePayoutCountParams struct {
|
|
UserID int64 `json:"user_id"`
|
|
Status string `json:"status"`
|
|
}
|
|
|
|
func (q *Queries) AffiliatePayoutCount(ctx context.Context, arg AffiliatePayoutCountParams) (int64, error) {
|
|
row := q.db.QueryRow(ctx, AffiliatePayoutCount, arg.UserID, arg.Status)
|
|
var count int64
|
|
err := row.Scan(&count)
|
|
return count, err
|
|
}
|
|
|
|
const AffiliatePayouts = `-- name: AffiliatePayouts :many
|
|
SELECT id,user_id,currency,amount::text AS amount,status,method,account_name,account_reference,payment_reference,review_note,reviewed_by,created_at,reviewed_at
|
|
FROM affiliate_payouts WHERE ($1::bigint=0 OR user_id=$1) AND ($2::text='' OR status=$2)
|
|
ORDER BY created_at DESC,id DESC LIMIT $4::int OFFSET $3::int
|
|
`
|
|
|
|
type AffiliatePayoutsParams struct {
|
|
UserID int64 `json:"user_id"`
|
|
Status string `json:"status"`
|
|
PageOffset int32 `json:"page_offset"`
|
|
PageLimit int32 `json:"page_limit"`
|
|
}
|
|
|
|
type AffiliatePayoutsRow struct {
|
|
ID int64 `json:"id"`
|
|
UserID int64 `json:"user_id"`
|
|
Currency string `json:"currency"`
|
|
Amount string `json:"amount"`
|
|
Status string `json:"status"`
|
|
Method string `json:"method"`
|
|
AccountName string `json:"account_name"`
|
|
AccountReference string `json:"account_reference"`
|
|
PaymentReference pgtype.Text `json:"payment_reference"`
|
|
ReviewNote string `json:"review_note"`
|
|
ReviewedBy pgtype.Int8 `json:"reviewed_by"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
ReviewedAt pgtype.Timestamptz `json:"reviewed_at"`
|
|
}
|
|
|
|
func (q *Queries) AffiliatePayouts(ctx context.Context, arg AffiliatePayoutsParams) ([]AffiliatePayoutsRow, error) {
|
|
rows, err := q.db.Query(ctx, AffiliatePayouts,
|
|
arg.UserID,
|
|
arg.Status,
|
|
arg.PageOffset,
|
|
arg.PageLimit,
|
|
)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
var items []AffiliatePayoutsRow
|
|
for rows.Next() {
|
|
var i AffiliatePayoutsRow
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.UserID,
|
|
&i.Currency,
|
|
&i.Amount,
|
|
&i.Status,
|
|
&i.Method,
|
|
&i.AccountName,
|
|
&i.AccountReference,
|
|
&i.PaymentReference,
|
|
&i.ReviewNote,
|
|
&i.ReviewedBy,
|
|
&i.CreatedAt,
|
|
&i.ReviewedAt,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const AffiliateProfile = `-- name: AffiliateProfile :one
|
|
SELECT a.user_id, a.status, a.application, a.terms_accepted_at, a.terms_version, a.reviewed_by, a.review_note, a.created_at, a.updated_at,u.email,u.first_name,u.last_name,COALESCE(rc.code,'')::text AS code
|
|
FROM affiliates a JOIN users u ON u.id=a.user_id LEFT JOIN referral_codes rc ON rc.user_id=a.user_id WHERE a.user_id=$1
|
|
`
|
|
|
|
type AffiliateProfileRow struct {
|
|
UserID int64 `json:"user_id"`
|
|
Status string `json:"status"`
|
|
Application string `json:"application"`
|
|
TermsAcceptedAt pgtype.Timestamptz `json:"terms_accepted_at"`
|
|
TermsVersion string `json:"terms_version"`
|
|
ReviewedBy pgtype.Int8 `json:"reviewed_by"`
|
|
ReviewNote string `json:"review_note"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
Email pgtype.Text `json:"email"`
|
|
FirstName pgtype.Text `json:"first_name"`
|
|
LastName pgtype.Text `json:"last_name"`
|
|
Code string `json:"code"`
|
|
}
|
|
|
|
func (q *Queries) AffiliateProfile(ctx context.Context, userID int64) (AffiliateProfileRow, error) {
|
|
row := q.db.QueryRow(ctx, AffiliateProfile, userID)
|
|
var i AffiliateProfileRow
|
|
err := row.Scan(
|
|
&i.UserID,
|
|
&i.Status,
|
|
&i.Application,
|
|
&i.TermsAcceptedAt,
|
|
&i.TermsVersion,
|
|
&i.ReviewedBy,
|
|
&i.ReviewNote,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Email,
|
|
&i.FirstName,
|
|
&i.LastName,
|
|
&i.Code,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const AffiliateRequestPayout = `-- name: AffiliateRequestPayout :one
|
|
SELECT affiliate_request_payout($1::bigint,$2::text,$3::text,$4::text,$5::text)::bigint AS id
|
|
`
|
|
|
|
type AffiliateRequestPayoutParams struct {
|
|
UserID int64 `json:"user_id"`
|
|
Currency string `json:"currency"`
|
|
Method string `json:"method"`
|
|
AccountName string `json:"account_name"`
|
|
AccountReference string `json:"account_reference"`
|
|
}
|
|
|
|
func (q *Queries) AffiliateRequestPayout(ctx context.Context, arg AffiliateRequestPayoutParams) (int64, error) {
|
|
row := q.db.QueryRow(ctx, AffiliateRequestPayout,
|
|
arg.UserID,
|
|
arg.Currency,
|
|
arg.Method,
|
|
arg.AccountName,
|
|
arg.AccountReference,
|
|
)
|
|
var id int64
|
|
err := row.Scan(&id)
|
|
return id, err
|
|
}
|
|
|
|
const AffiliateReverseCommission = `-- name: AffiliateReverseCommission :one
|
|
SELECT affiliate_reverse_commission($1::bigint,$2::bigint,$3::text)::bigint AS id
|
|
`
|
|
|
|
type AffiliateReverseCommissionParams struct {
|
|
CommissionID int64 `json:"commission_id"`
|
|
ActorID int64 `json:"actor_id"`
|
|
Reason string `json:"reason"`
|
|
}
|
|
|
|
func (q *Queries) AffiliateReverseCommission(ctx context.Context, arg AffiliateReverseCommissionParams) (int64, error) {
|
|
row := q.db.QueryRow(ctx, AffiliateReverseCommission, arg.CommissionID, arg.ActorID, arg.Reason)
|
|
var id int64
|
|
err := row.Scan(&id)
|
|
return id, err
|
|
}
|
|
|
|
const AffiliateReview = `-- name: AffiliateReview :one
|
|
SELECT affiliate_review($1::bigint,$2::text,$3::bigint,$4::text)::bigint AS user_id
|
|
`
|
|
|
|
type AffiliateReviewParams struct {
|
|
UserID int64 `json:"user_id"`
|
|
Status string `json:"status"`
|
|
ActorID int64 `json:"actor_id"`
|
|
Note string `json:"note"`
|
|
}
|
|
|
|
func (q *Queries) AffiliateReview(ctx context.Context, arg AffiliateReviewParams) (int64, error) {
|
|
row := q.db.QueryRow(ctx, AffiliateReview,
|
|
arg.UserID,
|
|
arg.Status,
|
|
arg.ActorID,
|
|
arg.Note,
|
|
)
|
|
var user_id int64
|
|
err := row.Scan(&user_id)
|
|
return user_id, err
|
|
}
|
|
|
|
const AffiliateReviewPayout = `-- name: AffiliateReviewPayout :one
|
|
SELECT affiliate_review_payout($1::bigint,$2::text,$3::bigint,$4::text,$5::text)::bigint AS id
|
|
`
|
|
|
|
type AffiliateReviewPayoutParams struct {
|
|
PayoutID int64 `json:"payout_id"`
|
|
Status string `json:"status"`
|
|
ActorID int64 `json:"actor_id"`
|
|
PaymentReference string `json:"payment_reference"`
|
|
Note string `json:"note"`
|
|
}
|
|
|
|
func (q *Queries) AffiliateReviewPayout(ctx context.Context, arg AffiliateReviewPayoutParams) (int64, error) {
|
|
row := q.db.QueryRow(ctx, AffiliateReviewPayout,
|
|
arg.PayoutID,
|
|
arg.Status,
|
|
arg.ActorID,
|
|
arg.PaymentReference,
|
|
arg.Note,
|
|
)
|
|
var id int64
|
|
err := row.Scan(&id)
|
|
return id, err
|
|
}
|
|
|
|
const AffiliateSettings = `-- name: AffiliateSettings :one
|
|
SELECT commission_percent::text AS commission_percent,commission_mode,attribution_days,holding_days,share_base_url,updated_at FROM referral_settings WHERE id=TRUE
|
|
`
|
|
|
|
type AffiliateSettingsRow struct {
|
|
CommissionPercent string `json:"commission_percent"`
|
|
CommissionMode string `json:"commission_mode"`
|
|
AttributionDays int32 `json:"attribution_days"`
|
|
HoldingDays int32 `json:"holding_days"`
|
|
ShareBaseUrl string `json:"share_base_url"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
func (q *Queries) AffiliateSettings(ctx context.Context) (AffiliateSettingsRow, error) {
|
|
row := q.db.QueryRow(ctx, AffiliateSettings)
|
|
var i AffiliateSettingsRow
|
|
err := row.Scan(
|
|
&i.CommissionPercent,
|
|
&i.CommissionMode,
|
|
&i.AttributionDays,
|
|
&i.HoldingDays,
|
|
&i.ShareBaseUrl,
|
|
&i.UpdatedAt,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const AffiliateUpdateSettings = `-- name: AffiliateUpdateSettings :one
|
|
UPDATE referral_settings SET commission_percent=$1::numeric,commission_mode=$2::text,
|
|
attribution_days=$3::int,holding_days=$4::int,share_base_url=$5::text,updated_by=$6::bigint,updated_at=now() WHERE id=TRUE
|
|
RETURNING commission_percent::text AS commission_percent,commission_mode,attribution_days,holding_days,share_base_url,updated_at
|
|
`
|
|
|
|
type AffiliateUpdateSettingsParams struct {
|
|
CommissionPercent pgtype.Numeric `json:"commission_percent"`
|
|
CommissionMode string `json:"commission_mode"`
|
|
AttributionDays int32 `json:"attribution_days"`
|
|
HoldingDays int32 `json:"holding_days"`
|
|
ShareBaseUrl string `json:"share_base_url"`
|
|
ActorID int64 `json:"actor_id"`
|
|
}
|
|
|
|
type AffiliateUpdateSettingsRow struct {
|
|
CommissionPercent string `json:"commission_percent"`
|
|
CommissionMode string `json:"commission_mode"`
|
|
AttributionDays int32 `json:"attribution_days"`
|
|
HoldingDays int32 `json:"holding_days"`
|
|
ShareBaseUrl string `json:"share_base_url"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
func (q *Queries) AffiliateUpdateSettings(ctx context.Context, arg AffiliateUpdateSettingsParams) (AffiliateUpdateSettingsRow, error) {
|
|
row := q.db.QueryRow(ctx, AffiliateUpdateSettings,
|
|
arg.CommissionPercent,
|
|
arg.CommissionMode,
|
|
arg.AttributionDays,
|
|
arg.HoldingDays,
|
|
arg.ShareBaseUrl,
|
|
arg.ActorID,
|
|
)
|
|
var i AffiliateUpdateSettingsRow
|
|
err := row.Scan(
|
|
&i.CommissionPercent,
|
|
&i.CommissionMode,
|
|
&i.AttributionDays,
|
|
&i.HoldingDays,
|
|
&i.ShareBaseUrl,
|
|
&i.UpdatedAt,
|
|
)
|
|
return i, err
|
|
}
|