database

package
v0.0.0-...-2ce5aaf Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *gorm.DB) *gorm.DB

Migrate the whole data model

Types

type Config

type Config struct {
	Hostname string
	Port     int
	Dialect  string
	Username string
	Password string
	Name     string
	Charset  string
	Migrate  bool
}

Config defines the database configuration

type Customer

type Customer struct {
	gorm.Model

	Name string `gorm:"not null"`
}

Customer ...

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is the database service

func NewService

func NewService(config Config) *Service

NewService returns the database handler as DataAccessor. It also opens the database connection using the given config.

func (*Service) CreateCustomer

func (s *Service) CreateCustomer(ctx context.Context, c adding.Customer) (uint, error)

CreateCustomer ...

Jump to

Keyboard shortcuts

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