Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use pointer receivers #445

Merged
merged 1 commit into from
Mar 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions database/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type Rat struct {
*big.Rat
}

func (r Rat) Value() (driver.Value, error) {
func (r *Rat) Value() (driver.Value, error) {
if r.Rat == nil {
return "", nil
}
Expand All @@ -51,8 +51,8 @@ func (r *Rat) Scan(val any) error {

type Uint64 uint64

func (u Uint64) Value() (driver.Value, error) {
return strconv.FormatUint(uint64(u), 10), nil
func (u *Uint64) Value() (driver.Value, error) {
return strconv.FormatUint(uint64(*u), 10), nil
}

func (u *Uint64) Scan(val any) error {
Expand Down
6 changes: 3 additions & 3 deletions state/models/utxo.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 Blink Labs Software
// Copyright 2025 Blink Labs Software
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -35,11 +35,11 @@ type Utxo struct {
Cbor []byte `gorm:"-"` // This is here for convenience but not represented in the metadata DB
}

func (Utxo) TableName() string {
func (u *Utxo) TableName() string {
return "utxo"
}

func (u Utxo) Decode() (ledger.TransactionOutput, error) {
func (u *Utxo) Decode() (ledger.TransactionOutput, error) {
return ledger.NewTransactionOutputFromCbor(u.Cbor)
}

Expand Down