models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTables

func CreateTables()

CreateTables execute SQL staments to create tables into database

func GetDB

func GetDB() *sql.DB

GetDB return the database connection object

func GetDomainsCountDB

func GetDomainsCountDB() (int, error)

GetDomainsCountDB get the number of all most recent and valid domains into database

func InitDB

func InitDB()

InitDB function init the connection to database

func ServersChanges

func ServersChanges(servers, previousServers []*Server) bool

ServersChanges determine if two collection of servers are equal

Types

type Domain

type Domain struct {
	ID               int64
	Name             string
	ServersChanged   bool
	SslGrade         string
	PreviousSslGrade string
	Title            string
	IsDown           bool
	IsValid          bool
	CreatedAt        time.Time
}

Domain structure manipulate data of domains table into database

func GetDomainByNameDB

func GetDomainByNameDB(name string) (*Domain, error)

GetDomainByNameDB get most recent domain saved into database by name

func GetDomainsDB

func GetDomainsDB(offset, limit string) ([]*Domain, error)

GetDomainsDB get part (by offset and limit) of most recent and valid domains into database

func (*Domain) Save

func (domain *Domain) Save() error

Save method save domain into database

type Server

type Server struct {
	ID       int64
	Address  string
	SslGrade string
	Country  string
	Owner    string
	DomainID int64
}

Server structure manipulate data of servers table into database

func GetServersByDomainDB

func GetServersByDomainDB(domain *Domain) ([]*Server, error)

GetServersByDomainDB get all servers of a domain saved into database

func (*Server) Equal

func (server *Server) Equal(otherServer *Server) bool

Equal determine if two server are equal

func (*Server) Save

func (server *Server) Save(domain *Domain) error

Save method save server into database

Jump to

Keyboard shortcuts

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