my

package
v0.0.0-...-e8acdfa Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDB *gorm.DB

Functions

func TableName

func TableName(m interface{}) string

TableName return the table name of a given gorm model. It checks whetehr the method TableName has been used or not. It then retreives the appropriate table name. This function accepts both, model and a its pointer

Types

type Field

type Field struct {
	Name    string  `gorm:"column:Field"`
	Type    string  `gorm:"column:Type"`
	Null    string  `gorm:"column:Null"`
	Key     string  `gorm:"column:Key"`
	Default *string `gorm:"column:Default"`
	Extra   string  `gorm:"column:Extra"`
}

func (*Field) GetInfo

func (f *Field) GetInfo() string

type Table

type Table struct {
	Name string
}

func NewTable

func NewTable(name string) *Table

func NewTableFromModel

func NewTableFromModel(model interface{}) *Table

func (*Table) ContainsData

func (t *Table) ContainsData() bool

func (*Table) Drop

func (t *Table) Drop(force bool) bool

func (*Table) Exists

func (t *Table) Exists() bool

Exists checks if the table is present in the database or not

func (*Table) GetAutoIncrField

func (t *Table) GetAutoIncrField() *Field

func (*Table) GetField

func (t *Table) GetField(field string) *Field

func (*Table) GetFields

func (t *Table) GetFields() []Field

func (*Table) GetPrimaryKeys

func (t *Table) GetPrimaryKeys() []Field

Jump to

Keyboard shortcuts

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