mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-12-01 09:07:27 +08:00
545 lines
17 KiB
Go
545 lines
17 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.30.0
|
|
// source: review.sql
|
|
|
|
package sqlc
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
const advanceDraftMatch = `-- name: AdvanceDraftMatch :exec
|
|
UPDATE resource_drafts SET payload = jsonb_set(payload, '{_match}', to_jsonb($1::text))
|
|
WHERE resource_type=$2 AND resource_id=$3 AND payload->>'_match'=$4::text
|
|
`
|
|
|
|
type AdvanceDraftMatchParams struct {
|
|
NextMatch string
|
|
ResourceType string
|
|
ResourceID string
|
|
PreviousMatch string
|
|
}
|
|
|
|
func (q *Queries) AdvanceDraftMatch(ctx context.Context, arg AdvanceDraftMatchParams) error {
|
|
_, err := q.db.Exec(ctx, advanceDraftMatch,
|
|
arg.NextMatch,
|
|
arg.ResourceType,
|
|
arg.ResourceID,
|
|
arg.PreviousMatch,
|
|
)
|
|
return err
|
|
}
|
|
|
|
const approvalOwner = `-- name: ApprovalOwner :one
|
|
SELECT requester_id FROM approval_requests WHERE id=$1
|
|
`
|
|
|
|
func (q *Queries) ApprovalOwner(ctx context.Context, id string) (string, error) {
|
|
row := q.db.QueryRow(ctx, approvalOwner, id)
|
|
var requester_id string
|
|
err := row.Scan(&requester_id)
|
|
return requester_id, err
|
|
}
|
|
|
|
const autoApproveShare = `-- name: AutoApproveShare :exec
|
|
UPDATE approval_requests SET status='approved',decided_at=now() WHERE id=$1 AND status='pending'
|
|
`
|
|
|
|
func (q *Queries) AutoApproveShare(ctx context.Context, id string) error {
|
|
_, err := q.db.Exec(ctx, autoApproveShare, id)
|
|
return err
|
|
}
|
|
|
|
const clearDraft = `-- name: ClearDraft :exec
|
|
WITH removed AS (DELETE FROM resource_drafts d WHERE d.resource_type=$1 AND d.resource_id=$2 AND d.owner_id=$3 RETURNING d.approval_id) UPDATE approval_requests a SET status='rejected',decided_at=now(),updated_at=now(),reason=$4 WHERE a.id IN(SELECT approval_id FROM removed) AND a.status='pending'
|
|
`
|
|
|
|
type ClearDraftParams struct {
|
|
ResourceType string
|
|
ResourceID string
|
|
OwnerID string
|
|
Reason string
|
|
}
|
|
|
|
func (q *Queries) ClearDraft(ctx context.Context, arg ClearDraftParams) error {
|
|
_, err := q.db.Exec(ctx, clearDraft,
|
|
arg.ResourceType,
|
|
arg.ResourceID,
|
|
arg.OwnerID,
|
|
arg.Reason,
|
|
)
|
|
return err
|
|
}
|
|
|
|
const closeEmptyShareRequests = `-- name: CloseEmptyShareRequests :exec
|
|
UPDATE approval_requests a SET status='rejected', reason=$1,decided_at=now(),updated_at=now() WHERE a.status='pending' AND a.id::text=ANY($2::text[]) AND NOT EXISTS(SELECT 1 FROM approval_share_items i WHERE i.approval_id=a.id AND i.withdrawn_at IS NULL)
|
|
`
|
|
|
|
type CloseEmptyShareRequestsParams struct {
|
|
Reason string
|
|
Ids []string
|
|
}
|
|
|
|
func (q *Queries) CloseEmptyShareRequests(ctx context.Context, arg CloseEmptyShareRequestsParams) error {
|
|
_, err := q.db.Exec(ctx, closeEmptyShareRequests, arg.Reason, arg.Ids)
|
|
return err
|
|
}
|
|
|
|
const decideApproval = `-- name: DecideApproval :exec
|
|
UPDATE approval_requests SET status=$2,reviewer_id=$4::uuid,reason=$3,decided_at=now(),updated_at=now() WHERE id=$1
|
|
`
|
|
|
|
type DecideApprovalParams struct {
|
|
ID string
|
|
Status string
|
|
Reason string
|
|
Reviewer string
|
|
}
|
|
|
|
func (q *Queries) DecideApproval(ctx context.Context, arg DecideApprovalParams) error {
|
|
_, err := q.db.Exec(ctx, decideApproval,
|
|
arg.ID,
|
|
arg.Status,
|
|
arg.Reason,
|
|
arg.Reviewer,
|
|
)
|
|
return err
|
|
}
|
|
|
|
const draftAction = `-- name: DraftAction :one
|
|
SELECT r.action FROM resource_drafts d JOIN approval_requests r ON r.id=d.approval_id WHERE d.resource_type=$1 AND d.resource_id=$2 AND d.owner_id=$3
|
|
`
|
|
|
|
type DraftActionParams struct {
|
|
ResourceType string
|
|
ResourceID string
|
|
OwnerID string
|
|
}
|
|
|
|
func (q *Queries) DraftAction(ctx context.Context, arg DraftActionParams) (string, error) {
|
|
row := q.db.QueryRow(ctx, draftAction, arg.ResourceType, arg.ResourceID, arg.OwnerID)
|
|
var action string
|
|
err := row.Scan(&action)
|
|
return action, err
|
|
}
|
|
|
|
const draftPayload = `-- name: DraftPayload :one
|
|
SELECT payload FROM resource_drafts WHERE approval_id=$1 AND owner_id=$2 FOR UPDATE
|
|
`
|
|
|
|
type DraftPayloadParams struct {
|
|
ApprovalID string
|
|
OwnerID string
|
|
}
|
|
|
|
func (q *Queries) DraftPayload(ctx context.Context, arg DraftPayloadParams) ([]byte, error) {
|
|
row := q.db.QueryRow(ctx, draftPayload, arg.ApprovalID, arg.OwnerID)
|
|
var payload []byte
|
|
err := row.Scan(&payload)
|
|
return payload, err
|
|
}
|
|
|
|
const dropDraft = `-- name: DropDraft :exec
|
|
DELETE FROM resource_drafts WHERE approval_id=$1
|
|
`
|
|
|
|
func (q *Queries) DropDraft(ctx context.Context, approvalID string) error {
|
|
_, err := q.db.Exec(ctx, dropDraft, approvalID)
|
|
return err
|
|
}
|
|
|
|
const insertShareItems = `-- name: InsertShareItems :exec
|
|
INSERT INTO approval_share_items(approval_id,resource_type,resource_id,subject_type,subject_id,access_level)
|
|
SELECT $1::uuid, i.resource_type,i.resource_id,i.subject_type,i.subject_id,i.access_level
|
|
FROM jsonb_to_recordset($2::jsonb) AS i(resource_type text,resource_id uuid,subject_type text,subject_id uuid,access_level text)
|
|
`
|
|
|
|
type InsertShareItemsParams struct {
|
|
ApprovalID string
|
|
Items []byte
|
|
}
|
|
|
|
func (q *Queries) InsertShareItems(ctx context.Context, arg InsertShareItemsParams) error {
|
|
_, err := q.db.Exec(ctx, insertShareItems, arg.ApprovalID, arg.Items)
|
|
return err
|
|
}
|
|
|
|
const latestApprovedSubjects = `-- name: LatestApprovedSubjects :many
|
|
SELECT DISTINCT ON(i.subject_type,i.subject_id) i.subject_type,i.subject_id,i.approval_id
|
|
FROM approval_share_items i JOIN approval_requests a ON a.id=i.approval_id
|
|
WHERE i.resource_type=$1 AND i.resource_id=$2 AND a.requester_id=$3 AND a.status='approved' AND i.withdrawn_at IS NULL
|
|
ORDER BY i.subject_type,i.subject_id,a.decided_at DESC NULLS LAST,a.id DESC
|
|
`
|
|
|
|
type LatestApprovedSubjectsParams struct {
|
|
ResourceType string
|
|
ResourceID string
|
|
RequesterID string
|
|
}
|
|
|
|
type LatestApprovedSubjectsRow struct {
|
|
SubjectType string
|
|
SubjectID string
|
|
ApprovalID string
|
|
}
|
|
|
|
func (q *Queries) LatestApprovedSubjects(ctx context.Context, arg LatestApprovedSubjectsParams) ([]LatestApprovedSubjectsRow, error) {
|
|
rows, err := q.db.Query(ctx, latestApprovedSubjects, arg.ResourceType, arg.ResourceID, arg.RequesterID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
items := []LatestApprovedSubjectsRow{}
|
|
for rows.Next() {
|
|
var i LatestApprovedSubjectsRow
|
|
if err := rows.Scan(&i.SubjectType, &i.SubjectID, &i.ApprovalID); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const listApprovals = `-- name: ListApprovals :one
|
|
WITH filtered AS (SELECT a.id, a.requester_id, a.requester, a.action, a.resource_type, a.resource_id, a.summary, a.status, a.reviewer_id, a.reason, a.decided_at, a.created_at, a.updated_at, a.waiting_for_content FROM approval_request_details a WHERE ($3::text='' OR a.requester_id::text=$3) AND ($4::text='' OR a.status=$4) AND strpos(lower(a.requester),lower($5::text))>0 AND ($6::text='' OR a.resource_type=$6) AND ($7::text='' OR a.action=$7) AND (NOT $8::bool OR EXISTS(SELECT 1 FROM resource_drafts d WHERE d.approval_id=a.id)))
|
|
SELECT jsonb_build_object('total',(SELECT count(*) FROM filtered),'items',coalesce((SELECT jsonb_agg(to_jsonb(t) ORDER BY t.created_at DESC,t.id) FROM (SELECT id, requester_id, requester, action, resource_type, resource_id, summary, status, reviewer_id, reason, decided_at, created_at, updated_at, waiting_for_content FROM filtered ORDER BY created_at DESC,id LIMIT $2::int OFFSET $1::int)t),'[]'))::jsonb
|
|
`
|
|
|
|
type ListApprovalsParams struct {
|
|
PageOffset int32
|
|
PageSize int32
|
|
Owner string
|
|
State string
|
|
Requester string
|
|
Kind string
|
|
Operation string
|
|
Drafts bool
|
|
}
|
|
|
|
func (q *Queries) ListApprovals(ctx context.Context, arg ListApprovalsParams) ([]byte, error) {
|
|
row := q.db.QueryRow(ctx, listApprovals,
|
|
arg.PageOffset,
|
|
arg.PageSize,
|
|
arg.Owner,
|
|
arg.State,
|
|
arg.Requester,
|
|
arg.Kind,
|
|
arg.Operation,
|
|
arg.Drafts,
|
|
)
|
|
var column_1 []byte
|
|
err := row.Scan(&column_1)
|
|
return column_1, err
|
|
}
|
|
|
|
const lockApproval = `-- name: LockApproval :one
|
|
SELECT id FROM approval_requests WHERE id=$1 FOR UPDATE
|
|
`
|
|
|
|
func (q *Queries) LockApproval(ctx context.Context, id string) (string, error) {
|
|
row := q.db.QueryRow(ctx, lockApproval, id)
|
|
err := row.Scan(&id)
|
|
return id, err
|
|
}
|
|
|
|
const lockReviewOwner = `-- name: LockReviewOwner :exec
|
|
SELECT pg_advisory_xact_lock(hashtextextended('member-review:' || $1::text,0))
|
|
`
|
|
|
|
func (q *Queries) LockReviewOwner(ctx context.Context, owner string) error {
|
|
_, err := q.db.Exec(ctx, lockReviewOwner, owner)
|
|
return err
|
|
}
|
|
|
|
const memberInventory = `-- name: MemberInventory :one
|
|
WITH active AS (SELECT kind, id, owner_user_id, name, updated_at FROM review_resource_inventory f WHERE f.owner_user_id=$3::uuid AND f.kind=$4::text), draft AS (SELECT d.resource_id AS id,a.summary,a.status,a.id AS approval_id,a.reason,a.updated_at FROM resource_drafts d JOIN approval_requests a ON a.id=d.approval_id WHERE d.owner_id=$3 AND d.resource_type=$4), items AS (SELECT coalesce(d.id,f.id) AS id,coalesce(d.summary->>'display_name',d.summary->>'name',f.name) AS name,d.summary AS draft,d.status AS review_status,d.approval_id,d.reason,(f.id IS NOT NULL) AS has_effective_content,greatest(f.updated_at,d.updated_at) AS updated_at FROM active f FULL JOIN draft d ON f.id=d.id) SELECT jsonb_build_object('total',(SELECT count(*) FROM items),'items',coalesce((SELECT jsonb_agg(to_jsonb(t) ORDER BY t.updated_at DESC,t.id) FROM (SELECT id, name, draft, review_status, approval_id, reason, has_effective_content, updated_at FROM items ORDER BY updated_at DESC,id LIMIT $2::int OFFSET $1::int)t),'[]'))::jsonb
|
|
`
|
|
|
|
type MemberInventoryParams struct {
|
|
PageOffset int32
|
|
PageSize int32
|
|
Owner string
|
|
Kind string
|
|
}
|
|
|
|
func (q *Queries) MemberInventory(ctx context.Context, arg MemberInventoryParams) ([]byte, error) {
|
|
row := q.db.QueryRow(ctx, memberInventory,
|
|
arg.PageOffset,
|
|
arg.PageSize,
|
|
arg.Owner,
|
|
arg.Kind,
|
|
)
|
|
var column_1 []byte
|
|
err := row.Scan(&column_1)
|
|
return column_1, err
|
|
}
|
|
|
|
const ownerDraft = `-- name: OwnerDraft :one
|
|
SELECT d.payload, a.summary, a.action FROM resource_drafts d JOIN approval_requests a ON a.id=d.approval_id WHERE d.resource_type=$1 AND d.resource_id=$2 AND d.owner_id=$3 FOR UPDATE OF d
|
|
`
|
|
|
|
type OwnerDraftParams struct {
|
|
ResourceType string
|
|
ResourceID string
|
|
OwnerID string
|
|
}
|
|
|
|
type OwnerDraftRow struct {
|
|
Payload []byte
|
|
Summary []byte
|
|
Action string
|
|
}
|
|
|
|
func (q *Queries) OwnerDraft(ctx context.Context, arg OwnerDraftParams) (OwnerDraftRow, error) {
|
|
row := q.db.QueryRow(ctx, ownerDraft, arg.ResourceType, arg.ResourceID, arg.OwnerID)
|
|
var i OwnerDraftRow
|
|
err := row.Scan(&i.Payload, &i.Summary, &i.Action)
|
|
return i, err
|
|
}
|
|
|
|
const putDraft = `-- name: PutDraft :exec
|
|
INSERT INTO resource_drafts(resource_type,resource_id,owner_id,approval_id,payload) VALUES($1,$2,$3,$4,$5) ON CONFLICT(resource_type,resource_id) DO UPDATE SET approval_id=excluded.approval_id,payload=excluded.payload WHERE resource_drafts.owner_id=excluded.owner_id
|
|
`
|
|
|
|
type PutDraftParams struct {
|
|
ResourceType string
|
|
ResourceID string
|
|
OwnerID string
|
|
ApprovalID string
|
|
Payload []byte
|
|
}
|
|
|
|
func (q *Queries) PutDraft(ctx context.Context, arg PutDraftParams) error {
|
|
_, err := q.db.Exec(ctx, putDraft,
|
|
arg.ResourceType,
|
|
arg.ResourceID,
|
|
arg.OwnerID,
|
|
arg.ApprovalID,
|
|
arg.Payload,
|
|
)
|
|
return err
|
|
}
|
|
|
|
const queueRequest = `-- name: QueueRequest :one
|
|
INSERT INTO approval_requests(requester_id,resource_type,resource_id,action,summary) VALUES($1,$2,$3,$4,$5) RETURNING id
|
|
`
|
|
|
|
type QueueRequestParams struct {
|
|
RequesterID string
|
|
ResourceType string
|
|
ResourceID string
|
|
Action string
|
|
Summary []byte
|
|
}
|
|
|
|
func (q *Queries) QueueRequest(ctx context.Context, arg QueueRequestParams) (string, error) {
|
|
row := q.db.QueryRow(ctx, queueRequest,
|
|
arg.RequesterID,
|
|
arg.ResourceType,
|
|
arg.ResourceID,
|
|
arg.Action,
|
|
arg.Summary,
|
|
)
|
|
var id string
|
|
err := row.Scan(&id)
|
|
return id, err
|
|
}
|
|
|
|
const readApproval = `-- name: ReadApproval :one
|
|
SELECT to_jsonb(a) FROM approval_request_details a WHERE a.id=$1 AND ($2::text='' OR a.requester_id::text=$2)
|
|
`
|
|
|
|
type ReadApprovalParams struct {
|
|
ID string
|
|
Owner string
|
|
}
|
|
|
|
func (q *Queries) ReadApproval(ctx context.Context, arg ReadApprovalParams) ([]byte, error) {
|
|
row := q.db.QueryRow(ctx, readApproval, arg.ID, arg.Owner)
|
|
var to_jsonb []byte
|
|
err := row.Scan(&to_jsonb)
|
|
return to_jsonb, err
|
|
}
|
|
|
|
const refreshRequest = `-- name: RefreshRequest :one
|
|
UPDATE approval_requests a SET summary=$4,updated_at=now() WHERE a.id=(SELECT d.approval_id FROM resource_drafts d WHERE d.resource_type=$1 AND d.resource_id=$2 AND d.owner_id=$3) AND a.status='pending' RETURNING a.id
|
|
`
|
|
|
|
type RefreshRequestParams struct {
|
|
ResourceType string
|
|
ResourceID string
|
|
OwnerID string
|
|
Summary []byte
|
|
}
|
|
|
|
func (q *Queries) RefreshRequest(ctx context.Context, arg RefreshRequestParams) (string, error) {
|
|
row := q.db.QueryRow(ctx, refreshRequest,
|
|
arg.ResourceType,
|
|
arg.ResourceID,
|
|
arg.OwnerID,
|
|
arg.Summary,
|
|
)
|
|
var id string
|
|
err := row.Scan(&id)
|
|
return id, err
|
|
}
|
|
|
|
const requestedShareItems = `-- name: RequestedShareItems :many
|
|
SELECT resource_type,resource_id,subject_type,subject_id,access_level FROM approval_share_items WHERE approval_id=$1 AND withdrawn_at IS NULL ORDER BY resource_type,resource_id,subject_type,subject_id
|
|
`
|
|
|
|
type RequestedShareItemsRow struct {
|
|
ResourceType string
|
|
ResourceID string
|
|
SubjectType string
|
|
SubjectID string
|
|
AccessLevel string
|
|
}
|
|
|
|
func (q *Queries) RequestedShareItems(ctx context.Context, approvalID string) ([]RequestedShareItemsRow, error) {
|
|
rows, err := q.db.Query(ctx, requestedShareItems, approvalID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
items := []RequestedShareItemsRow{}
|
|
for rows.Next() {
|
|
var i RequestedShareItemsRow
|
|
if err := rows.Scan(
|
|
&i.ResourceType,
|
|
&i.ResourceID,
|
|
&i.SubjectType,
|
|
&i.SubjectID,
|
|
&i.AccessLevel,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const reviewIsAdmin = `-- name: ReviewIsAdmin :one
|
|
SELECT EXISTS(SELECT 1 FROM users WHERE id=$1 AND role='admin' AND status='active' AND deleted_at IS NULL)
|
|
`
|
|
|
|
func (q *Queries) ReviewIsAdmin(ctx context.Context, id string) (bool, error) {
|
|
row := q.db.QueryRow(ctx, reviewIsAdmin, id)
|
|
var exists bool
|
|
err := row.Scan(&exists)
|
|
return exists, err
|
|
}
|
|
|
|
const reviewPolicy = `-- name: ReviewPolicy :one
|
|
SELECT u.role, (SELECT value FROM settings WHERE key='member_resource_policy')::jsonb AS policy FROM users u WHERE u.id=$1 AND u.status='active' AND u.deleted_at IS NULL
|
|
`
|
|
|
|
type ReviewPolicyRow struct {
|
|
Role string
|
|
Policy []byte
|
|
}
|
|
|
|
func (q *Queries) ReviewPolicy(ctx context.Context, id string) (ReviewPolicyRow, error) {
|
|
row := q.db.QueryRow(ctx, reviewPolicy, id)
|
|
var i ReviewPolicyRow
|
|
err := row.Scan(&i.Role, &i.Policy)
|
|
return i, err
|
|
}
|
|
|
|
const reviewResourceName = `-- name: ReviewResourceName :one
|
|
SELECT name FROM review_resource_inventory WHERE kind=$1 AND id=$2
|
|
`
|
|
|
|
type ReviewResourceNameParams struct {
|
|
Kind string
|
|
ID string
|
|
}
|
|
|
|
func (q *Queries) ReviewResourceName(ctx context.Context, arg ReviewResourceNameParams) (string, error) {
|
|
row := q.db.QueryRow(ctx, reviewResourceName, arg.Kind, arg.ID)
|
|
var name string
|
|
err := row.Scan(&name)
|
|
return name, err
|
|
}
|
|
|
|
const shareHistory = `-- name: ShareHistory :many
|
|
SELECT to_jsonb(a) FROM approval_request_details a WHERE a.requester_id=$1 AND EXISTS (
|
|
SELECT 1 FROM approval_share_items i WHERE i.approval_id=a.id AND i.resource_type=$2::text AND i.resource_id=$3::uuid
|
|
) ORDER BY a.created_at DESC,a.id
|
|
`
|
|
|
|
type ShareHistoryParams struct {
|
|
RequesterID string
|
|
Kind string
|
|
Resource string
|
|
}
|
|
|
|
func (q *Queries) ShareHistory(ctx context.Context, arg ShareHistoryParams) ([][]byte, error) {
|
|
rows, err := q.db.Query(ctx, shareHistory, arg.RequesterID, arg.Kind, arg.Resource)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
items := [][]byte{}
|
|
for rows.Next() {
|
|
var to_jsonb []byte
|
|
if err := rows.Scan(&to_jsonb); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, to_jsonb)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const withdrawShareItems = `-- name: WithdrawShareItems :many
|
|
UPDATE approval_share_items i SET withdrawn_at=now() FROM approval_requests a WHERE i.approval_id=a.id AND a.requester_id=$1::uuid AND (a.status='pending' OR (NOT $2::boolean AND a.status='approved')) AND i.resource_type=$3::text AND i.resource_id=$4::uuid AND i.withdrawn_at IS NULL AND ($5::boolean OR (i.subject_type='user' AND i.subject_id::text=ANY($6::text[])) OR (i.subject_type='group' AND i.subject_id::text=ANY($7::text[]))) RETURNING i.approval_id
|
|
`
|
|
|
|
type WithdrawShareItemsParams struct {
|
|
Owner string
|
|
PendingOnly bool
|
|
Kind string
|
|
Resource string
|
|
WholeResource bool
|
|
UserIds []string
|
|
GroupIds []string
|
|
}
|
|
|
|
func (q *Queries) WithdrawShareItems(ctx context.Context, arg WithdrawShareItemsParams) ([]string, error) {
|
|
rows, err := q.db.Query(ctx, withdrawShareItems,
|
|
arg.Owner,
|
|
arg.PendingOnly,
|
|
arg.Kind,
|
|
arg.Resource,
|
|
arg.WholeResource,
|
|
arg.UserIds,
|
|
arg.GroupIds,
|
|
)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
items := []string{}
|
|
for rows.Next() {
|
|
var approval_id string
|
|
if err := rows.Scan(&approval_id); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, approval_id)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|