database

package
v0.0.0-...-a5914f9 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectDatabase

func ConnectDatabase()

func GetDatabase

func GetDatabase() *gorm.DB

Types

type AddressEntry

type AddressEntry struct {
	gorm.Model

	// ID of the record, auto incremented uint64 value
	ID uint64 `gorm:"primaryKey;autoIncrement:true"`

	// Address is the newly fetched address that differs from the previous registered
	Address string `gorm:"index" json:"address"`
	// PreviousAddress is the previous address, before the update
	PreviousAddress string `json:"previous_address"`

	// Version specifies the version of the address this record refers to
	Version string `json:"version"`
	// CreatedAt is the UNIX time when the address update was detected
	CreatedAt uint64 `gorm:"autoCreateTime" json:"at"`
}

func (AddressEntry) Create

func (e AddressEntry) Create(address string, version string, previous string) (*AddressEntry, error)

Create is the function that creates a new AddressEntry record onto the database

func (AddressEntry) First

func (e AddressEntry) First(addressVersion string) (*AddressEntry, error)

First returns the latest added record for a specific address version (addressVersion)

Jump to

Keyboard shortcuts

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