Skip to content

Commit 74c0717

Browse files
authored
fix(SPV-1069) fix lint errors for "models" package (#800)
1 parent a71b048 commit 74c0717

20 files changed

Lines changed: 43 additions & 19 deletions

models/bsv/satoshis.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
package bsv
22

3+
// Satoshis specifies a type that should be used to store value in satoshis
34
type Satoshis uint64

models/contact.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ import (
55
"github.com/bitcoin-sv/spv-wallet/models/response"
66
)
77

8+
// CreateContactResponse is a model for response on contact creation.
89
type CreateContactResponse struct {
910
Contact *Contact `json:"contact"`
1011
AdditionalInfo map[string]string `json:"additionalInfo"`
1112
}
1213

14+
// Contact is a model for contact.
1315
type Contact struct {
1416
common.Model
1517

@@ -25,6 +27,7 @@ type Contact struct {
2527
Status response.ContactStatus `json:"status" example:"unconfirmed"`
2628
}
2729

30+
// AddAdditionalInfo adds additional information (as key-value map) to the response.
2831
func (m *CreateContactResponse) AddAdditionalInfo(k, v string) {
2932
if m.AdditionalInfo == nil {
3033
m.AdditionalInfo = make(map[string]string)

models/filter/access_key_filter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package filter
33
// AccessKeyFilter is a struct for handling request parameters for destination search requests
44
type AccessKeyFilter struct {
55
// ModelFilter is a struct for handling typical request parameters for search requests
6-
//lint:ignore SA5008 We want to reuse json tags also to mapstructure.
6+
//nolint:staticcheck // SA5008 We want to reuse json tags also to mapstructure.
77
ModelFilter `json:",inline,squash"`
88

99
// RevokedRange specifies the time range when a record was revoked.

models/filter/contact_filter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package filter
33
// ContactFilter is a struct for handling request parameters for contact search requests
44
type ContactFilter struct {
55
// ModelFilter is a struct for handling typical request parameters for search requests
6-
//lint:ignore SA5008 We want to reuse json tags also to mapstructure.
6+
//nolint:staticcheck // SA5008 We want to reuse json tags also to mapstructure.
77
ModelFilter `json:",inline,squash"`
88
ID *string `json:"id" example:"ffdbe74e-0700-4710-aac5-611a1f877c7f"`
99
FullName *string `json:"fullName" example:"Alice"`

models/filter/destination_filter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package filter
33
// DestinationFilter is a struct for handling request parameters for destination search requests
44
type DestinationFilter struct {
55
// ModelFilter is a struct for handling typical request parameters for search requests
6-
//lint:ignore SA5008 We want to reuse json tags also to mapstructure.
6+
//nolint:staticcheck // SA5008 We want to reuse json tags also to mapstructure.
77
ModelFilter `json:",inline,squash"`
88
LockingScript *string `json:"lockingScript,omitempty" example:"76a9147b05764a97f3b4b981471492aa703b188e45979b88ac"`
99
Address *string `json:"address,omitempty" example:"1CDUf7CKu8ocTTkhcYUbq75t14Ft168K65"`

models/filter/generics.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type SearchModel[TFilter any] struct {
1616
QueryParams *QueryParams `json:"params,omitempty" swaggertype:"object,string" example:"page:1,page_size:10,order_by_field:created_at,order_by_direction:desc"`
1717
}
1818

19-
// DefaultsIfNil fills empty but neccessary fields with default values
19+
// DefaultsIfNil fills empty but necessary fields with default values
2020
func (sm *SearchModel[TFilter]) DefaultsIfNil() {
2121
if sm.QueryParams == nil {
2222
sm.QueryParams = DefaultQueryParams()

models/filter/paymail_filter.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package filter
33
// PaymailFilter is a struct for handling request parameters for paymail_addresses search requests
44
type PaymailFilter struct {
55
// ModelFilter is a struct for handling typical request parameters for search requests
6-
//lint:ignore SA5008 We want to reuse json tags also to mapstructure.
6+
//nolint:staticcheck // SA5008 We want to reuse json tags also to mapstructure.
77
ModelFilter `json:",inline,squash"`
88

99
ID *string `json:"id,omitempty" example:"ffb86c103d17d87c15aaf080aab6be5415c9fa885309a79b04c9910e39f2b542"`
@@ -28,13 +28,15 @@ func (d *PaymailFilter) ToDbConditions() map[string]interface{} {
2828
return conditions
2929
}
3030

31+
// AdminPaymailFilter wraps the PaymailFilter providing additional fields for admin paymail search requests
3132
type AdminPaymailFilter struct {
32-
//lint:ignore SA5008 We want to reuse json tags also to mapstructure.
33+
//nolint:staticcheck // SA5008 We want to reuse json tags also to mapstructure.
3334
PaymailFilter `json:",inline,squash"`
3435

3536
XpubID *string `json:"xpubId,omitempty" example:"79f90a6bab0a44402fc64828af820e9465645658aea2d138c5205b88e6dabd00"`
3637
}
3738

39+
// ToDbConditions converts filter fields to the datastore conditions using gorm naming strategy
3840
func (d *AdminPaymailFilter) ToDbConditions() map[string]interface{} {
3941
if d == nil {
4042
return nil

models/filter/search_params.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
package filter
22

3+
// Page is a struct for handling paging parameters for search requests
34
type Page struct {
45
Number int `json:"page,omitempty"`
56
Size int `json:"size,omitempty"`
67
Sort string `json:"sort,omitempty"`
78
SortBy string `json:"sortBy,omitempty"`
89
}
910

11+
// SearchParams is a generic struct for handling request parameters for search requests
1012
type SearchParams[T any] struct {
11-
Page Page `json:"paging,squash"`
13+
//nolint:staticcheck // SA5008 We want to reuse json tags also to mapstructure.
14+
Page Page `json:"paging,squash"`
15+
//nolint:staticcheck // SA5008 We want to reuse json tags also to mapstructure.
1216
Conditions T `json:"conditions,squash"`
1317
Metadata map[string]interface{} `json:"metadata,omitempty"`
1418
}

models/filter/transaction_admin_filter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package filter
22

33
// AdminTransactionFilter extends TransactionFilter for admin-specific use, including xpubid filtering
44
type AdminTransactionFilter struct {
5-
//lint:ignore SA5008 We want to reuse json tags also to mapstructure.
5+
//nolint:staticcheck // SA5008 We want to reuse json tags also to mapstructure.
66
TransactionFilter `json:",inline,squash"`
77
XPubID *string `json:"xpubid,omitempty" example:"623bc25ce1c0fc510dea72b5ee27b2e70384c099f1f3dce9e73dd987198c3486"`
88
}

models/filter/transaction_filter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package filter
33
// TransactionFilter is a struct for handling request parameters for transactions search requests
44
type TransactionFilter struct {
55
// ModelFilter is a struct for handling typical request parameters for search requests
6-
//lint:ignore SA5008 We want to reuse json tags also to mapstructure.
6+
//nolint:staticcheck // SA5008 We want to reuse json tags also to mapstructure.
77
ModelFilter `json:",inline,squash"`
88
Id *string `json:"id,omitempty" example:"d425432e0d10a46af1ec6d00f380e9581ebf7907f3486572b3cd561a4c326e14"`
99
Hex *string `json:"hex,omitempty"`

0 commit comments

Comments
 (0)