models

package
v0.0.0-...-f9ec6d5 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Namespace string

Namespace puts all tables names under a common namespace. This is useful if you want to use the same database for several services and don't want table names to collide.

Functions

func AutoMigrate

func AutoMigrate(db *gorm.DB) error

func Connect

func Connect(config *conf.DBConfig) (*gorm.DB, error)

Types

type Subscription

type Subscription struct {
	ID   string `gorm:"unique;primary",json:"id"`
	Type string `json:"type"`

	User   *User  `json:"user,omitempty"`
	UserID string `json:"user_id,omitempty"`

	RemoteID string `json:"remote_id"`
	Plan     string `json:"plan"`

	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	DeletedAt *time.Time `json:"-"`
}

func (*Subscription) BeforeCreate

func (s *Subscription) BeforeCreate(scope *gorm.Scope) error

func (Subscription) TableName

func (Subscription) TableName() string

type User

type User struct {
	ID       string `json:"id"`
	Email    string `json:"email"`
	RemoteID string `json:"remote_id"`

	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time
}

func (User) TableName

func (User) TableName() string

Jump to

Keyboard shortcuts

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