func (b boltRepo) Fetch(ticketID string) (*Ticket, error) {
	logrus.Trace("Trying to fetch ticket from BOLT: ", ticketID)

	ticket := &Ticket{}
	err := b.client.View(func(tx *bolt.Tx) error {
		bucket := tx.Bucket([]byte(BucketName))
		if bucket == nil {
			logrus.Trace("ticket not found in BOLT: ", ticketID, nil)
			return errTicketNotFound
		}

		data := bucket.Get([]byte(ticketID))
		if data == nil {
			logrus.Trace("ticket not found in BOLT: ", data, nil)
			return errTicketNotFound
		}

		err := json.Unmarshal([]byte(data), &ticket)
		if err != nil {
			return err
		}

		return nil
	})

	if err != nil {
		return nil, err
	}

	return ticket, nil
}
// Fetch a ticket from the repository, or err
Fetch a ticket from the repository, or err
// Fetch a ticket from the repository or err
func (b boltRepo) Fetch(ticketID string) (*Ticket, error) {
	logrus.Trace("Trying to fetch ticket from BOLT: ", ticketID)
	ticket := &Ticket{}
	err := b.client.View(func(tx *bolt.Tx) error {
		bucket := tx.Bucket([]byte(BucketName))
		if bucket == nil {
			logrus.Trace("ticket not found in BOLT: ", ticketID, nil)
			return errTicketNotFound
		}
		data := bucket.Get([]byte(ticketID))
		if data == nil {
			logrus.Trace("ticket not found in BOLT: ", data, nil)
			return errTicketNotFound
		}
		err := json.Unmarshal([]byte(data), &ticket)
		if err != nil {
			return err
		}
		return nil
	})
	if err != nil {
		return nil, err
	}
	return ticket, nil
}
func ( b boltRepo ) Fetch ( ticketID string ) ( * Ticket , error ) { logrus . Trace ( " " , ticketID ) ticket := & Ticket { } err := b . client . View ( func ( tx * bolt . Tx ) error { bucket := tx . Bucket ( [ ] byte ( BucketName ) ) if bucket == nil { logrus . Trace ( " " , ticketID , nil ) return errTicketNotFound } data := bucket . Get ( [ ] byte ( ticketID ) ) if data == nil { logrus . Trace ( " " , data , nil ) return errTicketNotFound } err := json . Unmarshal ( [ ] byte ( data ) , & ticket ) if err != nil { return err } return nil } ) if err != nil { return nil , err } return ticket , nil }
Fetch a ticket from the repository, or err
Fetch a ticket from the repository or err