Documentation
¶
Overview ¶
Package orm manages access to a database, including ORM-like functionality.
The package wraps the GORM library, which can then be potentially swapped out with minimal changes.
Index ¶
- Variables
- type Model
- type ORM
- func (orm ORM) AutoMigrate(models []interface{}) error
- func (orm ORM) Begin() *gorm.DB
- func (orm ORM) Create(model interface{}) *gorm.DB
- func (orm ORM) Exec(query string, output interface{}) *gorm.DB
- func (orm ORM) First(model interface{}, where ...interface{}) *gorm.DB
- func (orm ORM) Last(model interface{}, where ...interface{}) *gorm.DB
- func (orm ORM) Model(model interface{}) *gorm.DB
- func (orm ORM) ModelExistsWithID(model interface{}, id uint) (bool, error)
- func (orm ORM) ModelWithID(model interface{}, id uint) error
- func (orm *ORM) Open(dialect, connectionString string) (*gorm.DB, error)
- func (orm ORM) Save(value interface{}) *gorm.DB
- func (orm ORM) Where(query interface{}, args ...interface{}) *gorm.DB
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrRecordNotFound is the error returned when trying to load a record // that cannot be found. ErrRecordNotFound = gorm.ErrRecordNotFound )
Functions ¶
This section is empty.
Types ¶
type ORM ¶
type ORM struct {
// contains filtered or unexported fields
}
ORM is a container for the underlying database connection.
func (ORM) AutoMigrate ¶
AutoMigrate performs database migration for all Model types provided.
func (ORM) ModelExistsWithID ¶
ModelExistsWithID returns a boolean indicating if an instance of the specified model exists with a given ID.
func (ORM) ModelWithID ¶
ModelWithID returns an instance of the specified model with the given ID.
Click to show internal directories.
Click to hide internal directories.