models

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Name        string `json:"name"`
	Street      string `json:"street"`
	HouseNumber string `json:"houseNumber"`
	Town        string `json:"town"`
}

func (*Address) IsValid

func (a *Address) IsValid() bool

func (*Address) Scan

func (a *Address) Scan(value interface{}) error

Make the Address struct implement the sql.Scanner interface. This method simply decodes a JSON-encoded value into the struct fields. Ref: https://www.alexedwards.net/blog/using-postgresql-jsonb

func (Address) Value

func (a Address) Value() (driver.Value, error)

Make the Address struct implement the driver.Valuer interface. This method simply returns the JSON-encoded representation of the struct. Ref: https://www.alexedwards.net/blog/using-postgresql-jsonb

type Block

type Block struct {
	Transactions []Transaction `json:"Transactions"`
	// contains filtered or unexported fields
}

func (*Block) GetHash

func (b *Block) GetHash() [32]byte

func (*Block) IsValid

func (b *Block) IsValid() bool

type Transaction

type Transaction struct {
	Id               uuid.UUID `json:"id"`
	RecipientAddress Address   `json:"recipientAddress"`
	SenderAddress    Address   `json:"senderAddress"`
	Value            float32   `json:"value"`
}

func (*Transaction) IsValid

func (t *Transaction) IsValid() bool

Alterantive: use factory function and make structs private http://www.golangpatterns.info/object-oriented/constructors

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL