fix: golangci-lint version (#1381)

* chore: update interface declare

* chore: update args

* chore: update

* chore: update
pull/1382/head
boojack 2 years ago committed by GitHub
parent 573f07ec82
commit ff8851fd9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -23,7 +23,8 @@ jobs:
- name: golangci-lint - name: golangci-lint
uses: golangci/golangci-lint-action@v3 uses: golangci/golangci-lint-action@v3
with: with:
args: -v version: v1.52.0
args: -v --timeout=3m
skip-cache: true skip-cache: true
go-tests: go-tests:

@ -19,7 +19,7 @@ type ChatCompletionChoice struct {
} }
type ChatCompletionResponse struct { type ChatCompletionResponse struct {
Error interface{} `json:"error"` Error any `json:"error"`
Model string `json:"model"` Model string `json:"model"`
Choices []ChatCompletionChoice `json:"choices"` Choices []ChatCompletionChoice `json:"choices"`
} }
@ -33,7 +33,7 @@ func PostChatCompletion(messages []ChatCompletionMessage, apiKey string, apiHost
return "", err return "", err
} }
values := map[string]interface{}{ values := map[string]any{
"model": "gpt-3.5-turbo", "model": "gpt-3.5-turbo",
"messages": messages, "messages": messages,
"max_tokens": 2000, "max_tokens": 2000,

@ -14,7 +14,7 @@ type TextCompletionChoice struct {
} }
type TextCompletionResponse struct { type TextCompletionResponse struct {
Error interface{} `json:"error"` Error any `json:"error"`
Model string `json:"model"` Model string `json:"model"`
Choices []TextCompletionChoice `json:"choices"` Choices []TextCompletionChoice `json:"choices"`
} }
@ -28,7 +28,7 @@ func PostTextCompletion(prompt string, apiKey string, apiHost string) (string, e
return "", err return "", err
} }
values := map[string]interface{}{ values := map[string]any{
"model": "gpt-3.5-turbo", "model": "gpt-3.5-turbo",
"prompt": prompt, "prompt": prompt,
"temperature": 0.5, "temperature": 0.5,

@ -28,7 +28,7 @@ type Client struct {
} }
func NewClient(ctx context.Context, config *Config) (*Client, error) { func NewClient(ctx context.Context, config *Config) (*Client, error) {
resolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) { resolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...any) (aws.Endpoint, error) {
return aws.Endpoint{ return aws.Endpoint{
URL: config.EndPoint, URL: config.EndPoint,
SigningRegion: config.Region, SigningRegion: config.Region,

@ -9,10 +9,10 @@ import (
) )
type response struct { type response struct {
Data interface{} `json:"data"` Data any `json:"data"`
} }
func composeResponse(data interface{}) response { func composeResponse(data any) response {
return response{ return response{
Data: data, Data: data,
} }

@ -135,14 +135,14 @@ func getSystemCustomizedProfile(ctx context.Context, s *Server) (api.CustomizedP
continue continue
} }
var value interface{} var value any
err := json.Unmarshal([]byte(systemSetting.Value), &value) err := json.Unmarshal([]byte(systemSetting.Value), &value)
if err != nil { if err != nil {
return api.CustomizedProfile{}, err return api.CustomizedProfile{}, err
} }
if systemSetting.Name == api.SystemSettingCustomizedProfileName { if systemSetting.Name == api.SystemSettingCustomizedProfileName {
valueMap := value.(map[string]interface{}) valueMap := value.(map[string]any)
systemStatus.CustomizedProfile = api.CustomizedProfile{} systemStatus.CustomizedProfile = api.CustomizedProfile{}
if v := valueMap["name"]; v != nil { if v := valueMap["name"]; v != nil {
systemStatus.CustomizedProfile.Name = v.(string) systemStatus.CustomizedProfile.Name = v.(string)

@ -63,7 +63,7 @@ func (s *Server) registerSystemRoutes(g *echo.Group) {
continue continue
} }
var baseValue interface{} var baseValue any
err := json.Unmarshal([]byte(systemSetting.Value), &baseValue) err := json.Unmarshal([]byte(systemSetting.Value), &baseValue)
if err != nil { if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to unmarshal system setting value").SetInternal(err) return echo.NewHTTPError(http.StatusInternalServerError, "Failed to unmarshal system setting value").SetInternal(err)

@ -54,7 +54,7 @@ func (db *DB) UpsertMigrationHistory(ctx context.Context, upsert *MigrationHisto
} }
func findMigrationHistoryList(ctx context.Context, tx *sql.Tx, find *MigrationHistoryFind) ([]*MigrationHistory, error) { func findMigrationHistoryList(ctx context.Context, tx *sql.Tx, find *MigrationHistoryFind) ([]*MigrationHistory, error) {
where, args := []string{"1 = 1"}, []interface{}{} where, args := []string{"1 = 1"}, []any{}
if v := find.Version; v != nil { if v := find.Version; v != nil {
where, args = append(where, "version = ?"), append(args, *v) where, args = append(where, "version = ?"), append(args, *v)

@ -157,7 +157,7 @@ func (s *Store) UpdateIdentityProvider(ctx context.Context, update *UpdateIdenti
} }
defer tx.Rollback() defer tx.Rollback()
set, args := []string{}, []interface{}{} set, args := []string{}, []any{}
if v := update.Name; v != nil { if v := update.Name; v != nil {
set, args = append(set, "name = ?"), append(args, *v) set, args = append(set, "name = ?"), append(args, *v)
} }
@ -220,7 +220,7 @@ func (s *Store) DeleteIdentityProvider(ctx context.Context, delete *DeleteIdenti
} }
defer tx.Rollback() defer tx.Rollback()
where, args := []string{"id = ?"}, []interface{}{delete.ID} where, args := []string{"id = ?"}, []any{delete.ID}
stmt := `DELETE FROM idp WHERE ` + strings.Join(where, " AND ") stmt := `DELETE FROM idp WHERE ` + strings.Join(where, " AND ")
result, err := tx.ExecContext(ctx, stmt, args...) result, err := tx.ExecContext(ctx, stmt, args...)
if err != nil { if err != nil {
@ -242,7 +242,7 @@ func (s *Store) DeleteIdentityProvider(ctx context.Context, delete *DeleteIdenti
} }
func listIdentityProviders(ctx context.Context, tx *sql.Tx, find *FindIdentityProviderMessage) ([]*IdentityProviderMessage, error) { func listIdentityProviders(ctx context.Context, tx *sql.Tx, find *FindIdentityProviderMessage) ([]*IdentityProviderMessage, error) {
where, args := []string{"TRUE"}, []interface{}{} where, args := []string{"TRUE"}, []any{}
if v := find.ID; v != nil { if v := find.ID; v != nil {
where, args = append(where, fmt.Sprintf("id = $%d", len(args)+1)), append(args, *v) where, args = append(where, fmt.Sprintf("id = $%d", len(args)+1)), append(args, *v)
} }
@ -289,8 +289,10 @@ func listIdentityProviders(ctx context.Context, tx *sql.Tx, find *FindIdentityPr
} }
identityProviderMessages = append(identityProviderMessages, &identityProviderMessage) identityProviderMessages = append(identityProviderMessages, &identityProviderMessage)
} }
if err := rows.Err(); err != nil { if err := rows.Err(); err != nil {
return nil, FormatError(err) return nil, FormatError(err)
} }
return identityProviderMessages, nil return identityProviderMessages, nil
} }

@ -193,7 +193,7 @@ func (s *Store) DeleteMemo(ctx context.Context, delete *api.MemoDelete) error {
func createMemoRaw(ctx context.Context, tx *sql.Tx, create *api.MemoCreate) (*memoRaw, error) { func createMemoRaw(ctx context.Context, tx *sql.Tx, create *api.MemoCreate) (*memoRaw, error) {
set := []string{"creator_id", "content", "visibility"} set := []string{"creator_id", "content", "visibility"}
args := []interface{}{create.CreatorID, create.Content, create.Visibility} args := []any{create.CreatorID, create.Content, create.Visibility}
placeholder := []string{"?", "?", "?"} placeholder := []string{"?", "?", "?"}
if v := create.CreatedTs; v != nil { if v := create.CreatedTs; v != nil {
@ -224,7 +224,7 @@ func createMemoRaw(ctx context.Context, tx *sql.Tx, create *api.MemoCreate) (*me
} }
func patchMemoRaw(ctx context.Context, tx *sql.Tx, patch *api.MemoPatch) (*memoRaw, error) { func patchMemoRaw(ctx context.Context, tx *sql.Tx, patch *api.MemoPatch) (*memoRaw, error) {
set, args := []string{}, []interface{}{} set, args := []string{}, []any{}
if v := patch.CreatedTs; v != nil { if v := patch.CreatedTs; v != nil {
set, args = append(set, "created_ts = ?"), append(args, *v) set, args = append(set, "created_ts = ?"), append(args, *v)
@ -267,7 +267,7 @@ func patchMemoRaw(ctx context.Context, tx *sql.Tx, patch *api.MemoPatch) (*memoR
} }
func findMemoRawList(ctx context.Context, tx *sql.Tx, find *api.MemoFind) ([]*memoRaw, error) { func findMemoRawList(ctx context.Context, tx *sql.Tx, find *api.MemoFind) ([]*memoRaw, error) {
where, args := []string{"1 = 1"}, []interface{}{} where, args := []string{"1 = 1"}, []any{}
if v := find.ID; v != nil { if v := find.ID; v != nil {
where, args = append(where, "memo.id = ?"), append(args, *v) where, args = append(where, "memo.id = ?"), append(args, *v)
@ -352,7 +352,7 @@ func findMemoRawList(ctx context.Context, tx *sql.Tx, find *api.MemoFind) ([]*me
} }
func deleteMemo(ctx context.Context, tx *sql.Tx, delete *api.MemoDelete) error { func deleteMemo(ctx context.Context, tx *sql.Tx, delete *api.MemoDelete) error {
where, args := []string{"id = ?"}, []interface{}{delete.ID} where, args := []string{"id = ?"}, []any{delete.ID}
stmt := `DELETE FROM memo WHERE ` + strings.Join(where, " AND ") stmt := `DELETE FROM memo WHERE ` + strings.Join(where, " AND ")
result, err := tx.ExecContext(ctx, stmt, args...) result, err := tx.ExecContext(ctx, stmt, args...)

@ -148,7 +148,7 @@ func upsertMemoOrganizer(ctx context.Context, tx *sql.Tx, upsert *api.MemoOrgani
} }
func deleteMemoOrganizer(ctx context.Context, tx *sql.Tx, delete *api.MemoOrganizerDelete) error { func deleteMemoOrganizer(ctx context.Context, tx *sql.Tx, delete *api.MemoOrganizerDelete) error {
where, args := []string{}, []interface{}{} where, args := []string{}, []any{}
if v := delete.MemoID; v != nil { if v := delete.MemoID; v != nil {
where, args = append(where, "memo_id = ?"), append(args, *v) where, args = append(where, "memo_id = ?"), append(args, *v)

@ -108,7 +108,7 @@ func (s *Store) DeleteMemoResource(ctx context.Context, delete *api.MemoResource
} }
func findMemoResourceList(ctx context.Context, tx *sql.Tx, find *api.MemoResourceFind) ([]*memoResourceRaw, error) { func findMemoResourceList(ctx context.Context, tx *sql.Tx, find *api.MemoResourceFind) ([]*memoResourceRaw, error) {
where, args := []string{"1 = 1"}, []interface{}{} where, args := []string{"1 = 1"}, []any{}
if v := find.MemoID; v != nil { if v := find.MemoID; v != nil {
where, args = append(where, "memo_id = ?"), append(args, *v) where, args = append(where, "memo_id = ?"), append(args, *v)
@ -157,7 +157,7 @@ func findMemoResourceList(ctx context.Context, tx *sql.Tx, find *api.MemoResourc
func upsertMemoResource(ctx context.Context, tx *sql.Tx, upsert *api.MemoResourceUpsert) (*memoResourceRaw, error) { func upsertMemoResource(ctx context.Context, tx *sql.Tx, upsert *api.MemoResourceUpsert) (*memoResourceRaw, error) {
set := []string{"memo_id", "resource_id"} set := []string{"memo_id", "resource_id"}
args := []interface{}{upsert.MemoID, upsert.ResourceID} args := []any{upsert.MemoID, upsert.ResourceID}
placeholder := []string{"?", "?"} placeholder := []string{"?", "?"}
if v := upsert.UpdatedTs; v != nil { if v := upsert.UpdatedTs; v != nil {
@ -188,7 +188,7 @@ func upsertMemoResource(ctx context.Context, tx *sql.Tx, upsert *api.MemoResourc
} }
func deleteMemoResource(ctx context.Context, tx *sql.Tx, delete *api.MemoResourceDelete) error { func deleteMemoResource(ctx context.Context, tx *sql.Tx, delete *api.MemoResourceDelete) error {
where, args := []string{}, []interface{}{} where, args := []string{}, []any{}
if v := delete.MemoID; v != nil { if v := delete.MemoID; v != nil {
where, args = append(where, "memo_id = ?"), append(args, *v) where, args = append(where, "memo_id = ?"), append(args, *v)

@ -192,7 +192,7 @@ func (s *Store) PatchResource(ctx context.Context, patch *api.ResourcePatch) (*a
func (s *Store) createResourceImpl(ctx context.Context, tx *sql.Tx, create *api.ResourceCreate) (*resourceRaw, error) { func (s *Store) createResourceImpl(ctx context.Context, tx *sql.Tx, create *api.ResourceCreate) (*resourceRaw, error) {
fields := []string{"filename", "blob", "external_link", "type", "size", "creator_id"} fields := []string{"filename", "blob", "external_link", "type", "size", "creator_id"}
values := []interface{}{create.Filename, create.Blob, create.ExternalLink, create.Type, create.Size, create.CreatorID} values := []any{create.Filename, create.Blob, create.ExternalLink, create.Type, create.Size, create.CreatorID}
placeholders := []string{"?", "?", "?", "?", "?", "?"} placeholders := []string{"?", "?", "?", "?", "?", "?"}
if s.profile.IsDev() { if s.profile.IsDev() {
fields = append(fields, "visibility") fields = append(fields, "visibility")
@ -208,7 +208,7 @@ func (s *Store) createResourceImpl(ctx context.Context, tx *sql.Tx, create *api.
RETURNING id, ` + strings.Join(fields, ",") + `, created_ts, updated_ts RETURNING id, ` + strings.Join(fields, ",") + `, created_ts, updated_ts
` `
var resourceRaw resourceRaw var resourceRaw resourceRaw
dests := []interface{}{ dests := []any{
&resourceRaw.ID, &resourceRaw.ID,
&resourceRaw.Filename, &resourceRaw.Filename,
&resourceRaw.Blob, &resourceRaw.Blob,
@ -220,7 +220,7 @@ func (s *Store) createResourceImpl(ctx context.Context, tx *sql.Tx, create *api.
if s.profile.IsDev() { if s.profile.IsDev() {
dests = append(dests, &resourceRaw.Visibility) dests = append(dests, &resourceRaw.Visibility)
} }
dests = append(dests, []interface{}{&resourceRaw.CreatedTs, &resourceRaw.UpdatedTs}...) dests = append(dests, []any{&resourceRaw.CreatedTs, &resourceRaw.UpdatedTs}...)
if err := tx.QueryRowContext(ctx, query, values...).Scan(dests...); err != nil { if err := tx.QueryRowContext(ctx, query, values...).Scan(dests...); err != nil {
return nil, FormatError(err) return nil, FormatError(err)
} }
@ -229,7 +229,7 @@ func (s *Store) createResourceImpl(ctx context.Context, tx *sql.Tx, create *api.
} }
func (s *Store) patchResourceImpl(ctx context.Context, tx *sql.Tx, patch *api.ResourcePatch) (*resourceRaw, error) { func (s *Store) patchResourceImpl(ctx context.Context, tx *sql.Tx, patch *api.ResourcePatch) (*resourceRaw, error) {
set, args := []string{}, []interface{}{} set, args := []string{}, []any{}
if v := patch.UpdatedTs; v != nil { if v := patch.UpdatedTs; v != nil {
set, args = append(set, "updated_ts = ?"), append(args, *v) set, args = append(set, "updated_ts = ?"), append(args, *v)
@ -256,7 +256,7 @@ func (s *Store) patchResourceImpl(ctx context.Context, tx *sql.Tx, patch *api.Re
WHERE id = ? WHERE id = ?
RETURNING ` + strings.Join(fields, ", ") RETURNING ` + strings.Join(fields, ", ")
var resourceRaw resourceRaw var resourceRaw resourceRaw
dests := []interface{}{ dests := []any{
&resourceRaw.ID, &resourceRaw.ID,
&resourceRaw.Filename, &resourceRaw.Filename,
&resourceRaw.ExternalLink, &resourceRaw.ExternalLink,
@ -277,7 +277,7 @@ func (s *Store) patchResourceImpl(ctx context.Context, tx *sql.Tx, patch *api.Re
} }
func (s *Store) findResourceListImpl(ctx context.Context, tx *sql.Tx, find *api.ResourceFind) ([]*resourceRaw, error) { func (s *Store) findResourceListImpl(ctx context.Context, tx *sql.Tx, find *api.ResourceFind) ([]*resourceRaw, error) {
where, args := []string{"1 = 1"}, []interface{}{} where, args := []string{"1 = 1"}, []any{}
if v := find.ID; v != nil { if v := find.ID; v != nil {
where, args = append(where, "resource.id = ?"), append(args, *v) where, args = append(where, "resource.id = ?"), append(args, *v)
@ -319,7 +319,7 @@ func (s *Store) findResourceListImpl(ctx context.Context, tx *sql.Tx, find *api.
resourceRawList := make([]*resourceRaw, 0) resourceRawList := make([]*resourceRaw, 0)
for rows.Next() { for rows.Next() {
var resourceRaw resourceRaw var resourceRaw resourceRaw
dests := []interface{}{ dests := []any{
&resourceRaw.LinkedMemoAmount, &resourceRaw.LinkedMemoAmount,
&resourceRaw.ID, &resourceRaw.ID,
&resourceRaw.Filename, &resourceRaw.Filename,
@ -350,7 +350,7 @@ func (s *Store) findResourceListImpl(ctx context.Context, tx *sql.Tx, find *api.
} }
func deleteResource(ctx context.Context, tx *sql.Tx, delete *api.ResourceDelete) error { func deleteResource(ctx context.Context, tx *sql.Tx, delete *api.ResourceDelete) error {
where, args := []string{"id = ?"}, []interface{}{delete.ID} where, args := []string{"id = ?"}, []any{delete.ID}
stmt := `DELETE FROM resource WHERE ` + strings.Join(where, " AND ") stmt := `DELETE FROM resource WHERE ` + strings.Join(where, " AND ")
result, err := tx.ExecContext(ctx, stmt, args...) result, err := tx.ExecContext(ctx, stmt, args...)

@ -180,7 +180,7 @@ func createShortcut(ctx context.Context, tx *sql.Tx, create *api.ShortcutCreate)
} }
func patchShortcut(ctx context.Context, tx *sql.Tx, patch *api.ShortcutPatch) (*shortcutRaw, error) { func patchShortcut(ctx context.Context, tx *sql.Tx, patch *api.ShortcutPatch) (*shortcutRaw, error) {
set, args := []string{}, []interface{}{} set, args := []string{}, []any{}
if v := patch.UpdatedTs; v != nil { if v := patch.UpdatedTs; v != nil {
set, args = append(set, "updated_ts = ?"), append(args, *v) set, args = append(set, "updated_ts = ?"), append(args, *v)
@ -220,7 +220,7 @@ func patchShortcut(ctx context.Context, tx *sql.Tx, patch *api.ShortcutPatch) (*
} }
func findShortcutList(ctx context.Context, tx *sql.Tx, find *api.ShortcutFind) ([]*shortcutRaw, error) { func findShortcutList(ctx context.Context, tx *sql.Tx, find *api.ShortcutFind) ([]*shortcutRaw, error) {
where, args := []string{"1 = 1"}, []interface{}{} where, args := []string{"1 = 1"}, []any{}
if v := find.ID; v != nil { if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v) where, args = append(where, "id = ?"), append(args, *v)
@ -277,7 +277,7 @@ func findShortcutList(ctx context.Context, tx *sql.Tx, find *api.ShortcutFind) (
} }
func deleteShortcut(ctx context.Context, tx *sql.Tx, delete *api.ShortcutDelete) error { func deleteShortcut(ctx context.Context, tx *sql.Tx, delete *api.ShortcutDelete) error {
where, args := []string{}, []interface{}{} where, args := []string{}, []any{}
if v := delete.ID; v != nil { if v := delete.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v) where, args = append(where, "id = ?"), append(args, *v)

@ -125,7 +125,7 @@ func (s *Store) DeleteStorage(ctx context.Context, delete *api.StorageDelete) er
func createStorageRaw(ctx context.Context, tx *sql.Tx, create *api.StorageCreate) (*storageRaw, error) { func createStorageRaw(ctx context.Context, tx *sql.Tx, create *api.StorageCreate) (*storageRaw, error) {
set := []string{"name", "type", "config"} set := []string{"name", "type", "config"}
args := []interface{}{create.Name, create.Type} args := []any{create.Name, create.Type}
placeholder := []string{"?", "?", "?"} placeholder := []string{"?", "?", "?"}
var configBytes []byte var configBytes []byte
@ -162,7 +162,7 @@ func createStorageRaw(ctx context.Context, tx *sql.Tx, create *api.StorageCreate
} }
func patchStorageRaw(ctx context.Context, tx *sql.Tx, patch *api.StoragePatch) (*storageRaw, error) { func patchStorageRaw(ctx context.Context, tx *sql.Tx, patch *api.StoragePatch) (*storageRaw, error) {
set, args := []string{}, []interface{}{} set, args := []string{}, []any{}
if v := patch.Name; v != nil { if v := patch.Name; v != nil {
set, args = append(set, "name = ?"), append(args, *v) set, args = append(set, "name = ?"), append(args, *v)
} }
@ -213,7 +213,7 @@ func patchStorageRaw(ctx context.Context, tx *sql.Tx, patch *api.StoragePatch) (
} }
func findStorageRawList(ctx context.Context, tx *sql.Tx, find *api.StorageFind) ([]*storageRaw, error) { func findStorageRawList(ctx context.Context, tx *sql.Tx, find *api.StorageFind) ([]*storageRaw, error) {
where, args := []string{"1 = 1"}, []interface{}{} where, args := []string{"1 = 1"}, []any{}
if v := find.ID; v != nil { if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v) where, args = append(where, "id = ?"), append(args, *v)
@ -269,7 +269,7 @@ func findStorageRawList(ctx context.Context, tx *sql.Tx, find *api.StorageFind)
} }
func deleteStorage(ctx context.Context, tx *sql.Tx, delete *api.StorageDelete) error { func deleteStorage(ctx context.Context, tx *sql.Tx, delete *api.StorageDelete) error {
where, args := []string{"id = ?"}, []interface{}{delete.ID} where, args := []string{"id = ?"}, []any{delete.ID}
stmt := `DELETE FROM storage WHERE ` + strings.Join(where, " AND ") stmt := `DELETE FROM storage WHERE ` + strings.Join(where, " AND ")
result, err := tx.ExecContext(ctx, stmt, args...) result, err := tx.ExecContext(ctx, stmt, args...)

@ -113,7 +113,7 @@ func upsertSystemSetting(ctx context.Context, tx *sql.Tx, upsert *api.SystemSett
} }
func findSystemSettingList(ctx context.Context, tx *sql.Tx, find *api.SystemSettingFind) ([]*systemSettingRaw, error) { func findSystemSettingList(ctx context.Context, tx *sql.Tx, find *api.SystemSettingFind) ([]*systemSettingRaw, error) {
where, args := []string{"1 = 1"}, []interface{}{} where, args := []string{"1 = 1"}, []any{}
if find.Name.String() != "" { if find.Name.String() != "" {
where, args = append(where, "name = ?"), append(args, find.Name.String()) where, args = append(where, "name = ?"), append(args, find.Name.String())
} }

@ -104,7 +104,7 @@ func upsertTag(ctx context.Context, tx *sql.Tx, upsert *api.TagUpsert) (*tagRaw,
} }
func findTagList(ctx context.Context, tx *sql.Tx, find *api.TagFind) ([]*tagRaw, error) { func findTagList(ctx context.Context, tx *sql.Tx, find *api.TagFind) ([]*tagRaw, error) {
where, args := []string{"creator_id = ?"}, []interface{}{find.CreatorID} where, args := []string{"creator_id = ?"}, []any{find.CreatorID}
query := ` query := `
SELECT SELECT
@ -141,7 +141,7 @@ func findTagList(ctx context.Context, tx *sql.Tx, find *api.TagFind) ([]*tagRaw,
} }
func deleteTag(ctx context.Context, tx *sql.Tx, delete *api.TagDelete) error { func deleteTag(ctx context.Context, tx *sql.Tx, delete *api.TagDelete) error {
where, args := []string{"name = ?", "creator_id = ?"}, []interface{}{delete.Name, delete.CreatorID} where, args := []string{"name = ?", "creator_id = ?"}, []any{delete.Name, delete.CreatorID}
stmt := `DELETE FROM tag WHERE ` + strings.Join(where, " AND ") stmt := `DELETE FROM tag WHERE ` + strings.Join(where, " AND ")
result, err := tx.ExecContext(ctx, stmt, args...) result, err := tx.ExecContext(ctx, stmt, args...)

@ -216,7 +216,7 @@ func createUser(ctx context.Context, tx *sql.Tx, create *api.UserCreate) (*userR
} }
func patchUser(ctx context.Context, tx *sql.Tx, patch *api.UserPatch) (*userRaw, error) { func patchUser(ctx context.Context, tx *sql.Tx, patch *api.UserPatch) (*userRaw, error) {
set, args := []string{}, []interface{}{} set, args := []string{}, []any{}
if v := patch.UpdatedTs; v != nil { if v := patch.UpdatedTs; v != nil {
set, args = append(set, "updated_ts = ?"), append(args, *v) set, args = append(set, "updated_ts = ?"), append(args, *v)
@ -272,7 +272,7 @@ func patchUser(ctx context.Context, tx *sql.Tx, patch *api.UserPatch) (*userRaw,
} }
func findUserList(ctx context.Context, tx *sql.Tx, find *api.UserFind) ([]*userRaw, error) { func findUserList(ctx context.Context, tx *sql.Tx, find *api.UserFind) ([]*userRaw, error) {
where, args := []string{"1 = 1"}, []interface{}{} where, args := []string{"1 = 1"}, []any{}
if v := find.ID; v != nil { if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v) where, args = append(where, "id = ?"), append(args, *v)

@ -118,7 +118,7 @@ func upsertUserSetting(ctx context.Context, tx *sql.Tx, upsert *api.UserSettingU
} }
func findUserSettingList(ctx context.Context, tx *sql.Tx, find *api.UserSettingFind) ([]*userSettingRaw, error) { func findUserSettingList(ctx context.Context, tx *sql.Tx, find *api.UserSettingFind) ([]*userSettingRaw, error) {
where, args := []string{"1 = 1"}, []interface{}{} where, args := []string{"1 = 1"}, []any{}
if v := find.Key.String(); v != "" { if v := find.Key.String(); v != "" {
where, args = append(where, "key = ?"), append(args, v) where, args = append(where, "key = ?"), append(args, v)

Loading…
Cancel
Save