database

package
v0.0.0-...-fa74e04 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DbName         = "xxxxx"
	CollectionName = "xxxxxxxxxxxx"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PaymentService

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

PaymentService holds the collection

func NewPaymentService

func NewPaymentService(session *mgo.Session, db string, col string) *PaymentService

NewPaymentService creates a new payment service

func (*PaymentService) CreatePayment

func (p *PaymentService) CreatePayment(u *models.Payment) error

CreatePayment creates a new payment

func (*PaymentService) DeletePayment

func (p *PaymentService) DeletePayment(id string) error

DeletePayment deletes it

func (*PaymentService) GetPaymentsByIDs

func (p *PaymentService) GetPaymentsByIDs(ids []string) ([]models.Payment, error)

GetPaymentsByIDs gets a list of payments

func (*PaymentService) UpdatePayment

func (p *PaymentService) UpdatePayment(u *models.Payment) error

UpdatePayment updates a payment by some id

type Session

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

Session is the mongodb session

func NewSession

func NewSession() (*Session, error)

NewSession creates a new session to work with. Connection url should be moved to some config files

func (*Session) Close

func (s *Session) Close()

Close ends the session

func (*Session) Copy

func (s *Session) Copy() *mgo.Session

Copy copies an existing session

func (*Session) DeleteCollection

func (s *Session) DeleteCollection() error

DeleteCollection delets a collection (for testing)

Jump to

Keyboard shortcuts

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