(ctx context.Context, arg BatchFileMetasParams)
| 112 | } |
| 113 | |
| 114 | func (q *Queries) BatchFileMetas(ctx context.Context, arg BatchFileMetasParams) ([]FileMeta, error) { |
| 115 | query := batchFileMetas |
| 116 | var queryParams []interface{} |
| 117 | queryParams = append(queryParams, arg.GraphID) |
| 118 | if len(arg.FileIds) > 0 { |
| 119 | for _, v := range arg.FileIds { |
| 120 | queryParams = append(queryParams, v) |
| 121 | } |
| 122 | query = strings.Replace(query, "/*SLICE:file_ids*/?", strings.Repeat(",?", len(arg.FileIds))[1:], 1) |
| 123 | } else { |
| 124 | query = strings.Replace(query, "/*SLICE:file_ids*/?", "NULL", 1) |
| 125 | } |
| 126 | rows, err := q.db.QueryContext(ctx, query, queryParams...) |
| 127 | if err != nil { |
| 128 | return nil, err |
| 129 | } |
| 130 | defer rows.Close() |
| 131 | var items []FileMeta |
| 132 | for rows.Next() { |
| 133 | var i FileMeta |
| 134 | if err := rows.Scan( |
| 135 | &i.ID, |
| 136 | &i.GraphID, |
| 137 | &i.FileID, |
| 138 | &i.BlobPath, |
| 139 | &i.Checksum, |
| 140 | &i.Size, |
| 141 | &i.LastModifiedAt, |
| 142 | &i.LastModifiedTx, |
| 143 | ); err != nil { |
| 144 | return nil, err |
| 145 | } |
| 146 | items = append(items, i) |
| 147 | } |
| 148 | if err := rows.Close(); err != nil { |
| 149 | return nil, err |
| 150 | } |
| 151 | if err := rows.Err(); err != nil { |
| 152 | return nil, err |
| 153 | } |
| 154 | return items, nil |
| 155 | } |
| 156 | |
| 157 | const createGraph = `-- name: CreateGraph :one |
| 158 | INSERT INTO graphs ( |
no test coverage detected