models

package
v0.0.0-...-41513e3 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AuthorImported indicates the author was imported from an external source.
	AuthorImported = 1 << iota

	// AuthorHasMultipleTitles is a convenience value indicating the author has multiple titles.
	AuthorHasMultipleTitles
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	ID           int            `marlow:"column=system_id&autoIncrement=true"`
	Name         string         `marlow:"column=name"`
	UniversityID sql.NullInt64  `marlow:"column=university_id"`
	ReaderRating float64        `marlow:"column=rating"`
	AuthorFlags  uint8          `marlow:"column=flags&bitmask"`
	Birthday     time.Time      `marlow:"column=birthday"`
	Deceased     mysql.NullTime `marlow:"column=deceased"`
	// contains filtered or unexported fields
}

Author represents an author of a book.

func (*Author) String

func (a *Author) String() string

type Book

type Book struct {
	ID            int           `marlow:"column=system_id&autoIncrement=true"`
	Title         string        `marlow:"column=title"`
	AuthorID      int           `marlow:"column=author"`
	SeriesID      sql.NullInt64 `marlow:"column=series"`
	YearPublished int           `marlow:"column=year_published" json:"year_published"`
	// contains filtered or unexported fields
}

Book represents a book in the example application

func (*Book) String

func (b *Book) String() string

String returns the book with good info.

type DatabaseConfig

type DatabaseConfig struct {
	Postgres struct {
		Username string
		Password string
		Database string
		Hostname string
		Port     string
	}
	SQLite struct {
		Filename string
	}
}

DatabaseConfig is a convenience type for storing the configuration necessary for the example app db connections.

type DatabaseConnections

type DatabaseConnections struct {
	Config *DatabaseConfig
	// contains filtered or unexported fields
}

DatabaseConnections represent the different connection types used by the example app.

func (*DatabaseConnections) Close

func (db *DatabaseConnections) Close() error

Close will attempt to close the open database connections.

func (*DatabaseConnections) Initialize

func (db *DatabaseConnections) Initialize() error

Initialize opens the various database connection types and seeds their database tables.

func (*DatabaseConnections) Stores

func (db *DatabaseConnections) Stores(logger io.Writer) *Stores

Stores builds the various model stores generated by marlow.

type Genre

type Genre struct {
	ID       uint          `marlow:"column=id&autoIncrement=true"`
	Name     string        `marlow:"column=name"`
	ParentID sql.NullInt64 `marlow:"column=parent_id"`
	// contains filtered or unexported fields
}

Genre records are used to group and describe a types of books.

func (*Genre) String

func (g *Genre) String() string

type MultiAuto

type MultiAuto struct {
	ID        uint        `marlow:"column=id&autoIncrement=true"`
	Status    string      `marlow:"column=status&autoIncrement=true"`
	Name      string      `marlow:"column=name"`
	CreatedAt time.Time   `marlow:"column=created_at"`
	DeletedAt pq.NullTime `marlow:"column=deleted_at"`
	// contains filtered or unexported fields
}

MultiAuto represents a record w/ mutliple auto-increment directives on a postgres model.

type Stores

type Stores struct {
	Authors AuthorStore
	Books   BookStore
	Genres  GenreStore
}

Stores is a convenience struct designed to group the generated stores into a single place.

Jump to

Keyboard shortcuts

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