db

package
v0.0.0-...-f676003 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2014 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Companies = sql.Table("companies",
	sql.Column("id", postgres.Serial{NotNull: true}),
	sql.Column("name", sql.String{Length: 255}),
	sql.Column("is_active", sql.Boolean{NotNull: true, Default: sql.True}),
	sql.Column(
		"created_at",
		sql.Timestamp{Default: "now() at time zone 'utc'"},
	),
	sql.PrimaryKey("id"),
	sql.Unique("name"),
)
View Source
var CompanyContacts = sql.Table("company_contacts",
	sql.Column("id", postgres.Serial{NotNull: true}),
	sql.ForeignKey(
		"company_id",
		Companies.C["id"],
		sql.Integer{NotNull: true},
	),
	sql.Column("key", sql.String{}),
	sql.Column("value", sql.String{}),
	sql.Column("is_public", sql.Boolean{Default: sql.True}),
	sql.Column(
		"created_at",
		sql.Timestamp{Default: "now() at time zone 'utc'"},
	),
	sql.PrimaryKey("id"),
	sql.Unique("company_id", "key"),
)

CompanyContacts includes all user contact information, such as phone numbers, addresses, and social media.

View Source
var CompanyIndustries = sql.Table("company_industries",
	sql.Column("id", postgres.Serial{NotNull: true}),
	sql.ForeignKey(
		"industry_id",
		Industries.C["id"],
		sql.Integer{NotNull: true},
	),
	sql.ForeignKey(
		"company_id",
		Companies.C["id"],
		sql.Integer{NotNull: true},
	),
	sql.Column(
		"created_at",
		sql.Timestamp{Default: "now() at time zone 'utc'"},
	),
	sql.Unique("industry_id", "company_id"),
	sql.PrimaryKey("id"),
)
View Source
var Industries = sql.Table("industries",
	sql.Column("id", postgres.Serial{NotNull: true}),
	sql.Column("name", sql.String{NotNull: true}),
	sql.Column("about", sql.String{NotNull: true}),
	sql.Column(
		"created_at",
		sql.Timestamp{Default: "now() at time zone 'utc'"},
	),
	sql.PrimaryKey("id"),
	sql.Unique("name"),
)
View Source
var Users = sql.Table("users",
	sql.Column("id", postgres.Serial{NotNull: true}),
	sql.Column("email", sql.String{NotNull: true}),
	sql.Column("password", sql.String{NotNull: true}),
	sql.Column("is_active", sql.Boolean{Default: sql.True}),
	sql.Column(
		"created_at",
		sql.Timestamp{Default: "now() at time zone 'utc'"},
	),
	sql.PrimaryKey("id"),
	sql.Unique("email"),
)

Functions

This section is empty.

Types

type Company

type Company struct {
	ID        int64     `db:"id"`
	Name      string    `db:"name"`
	IsActive  bool      `db:"is_active"`
	CreatedAt time.Time `db:"created_at"`
}

type CompanyContact

type CompanyContact struct {
	ID        int64     `db:"id"`
	CompanyID int64     `db:"company_id"`
	Key       string    `db:"key"`
	Value     string    `db:"value"`
	IsPublic  bool      `db:"is_public"`
	CreatedAt time.Time `db:"created_at"`
}

type CompanyIndustry

type CompanyIndustry struct {
	ID         int64 `db:"id"`
	IndustryID int64 `db:"industry_id"`
	CompanyID  int64 `db:"company_id"`
}

type Industry

type Industry struct {
	ID    int64  `db:"id"`
	Name  string `db:"name"`
	About string `db:"about"`
}

type User

type User struct {
	ID        int64     `db:"id"`
	Email     string    `db:"email"`
	Password  string    `db:"password"`
	IsActive  bool      `db:"is_public"`
	CreatedAt time.Time `db:"created_at"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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