db

package
v0.0.0-...-9870119 Latest Latest
Warning

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

Go to latest
Published: May 21, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	*gorm.DB
	// contains filtered or unexported fields
}

func NewDatabase

func NewDatabase(repoPath string) (*Database, error)

func (*Database) Close

func (db *Database) Close()

func (*Database) Index

func (db *Database) Index(txid string, fd FileDescriptor)

func (*Database) Query

func (db *Database) Query(searchTerm string, limit int, offset int) ([]string, error)

type FileDescriptor

type FileDescriptor struct {
	gorm.Model
	Txid        string    `json:"txid" gorm:"index;unique;not null"`
	Cid         string    `json:"cid"`
	Description string    `json:"description"`
	Category    string    `json:"category"`
	Timestamp   time.Time `json:"timestamp"`
	Upvotes     int64     `json:"upvotes"`
	Downvotes   int64     `json:"downvotes"`
	Net         int64     `json:"net"`
	Height      uint32    `json:"height"`
}

type Vote

type Vote struct {
	gorm.Model
	FDTxid    string    `json:"fdTxid" gorm:"index;not null"`
	Txid      string    `json:"txid" gorm:"unique;not null"`
	Comment   string    `json:"comment"`
	Timestamp time.Time `json:"timestamp"`
	Upvote    bool      `json:"upvote"`
	Height    uint32    `json:"height"`
}

Jump to

Keyboard shortcuts

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