// ReadStream will read all events associated with provided stream
// If there are no events stored for a given stream ErrStreamNotFound will be returned
ReadStream will read all events associated with provided stream
If there are no events stored for a given stream ErrStreamNotFound will be returned
// ReadStream will read all events associated with provided stream // If there are no events stored for a given stream ErrStreamNotFound will be returned
func (es *EventStore) ReadStream(ctx context.Context, stream string) ([]EventData, error) {
	var evts []gormEvent
	if len(stream) == 0 {
		return nil, fmt.Errorf("stream name must be provided")
	}
	if err := es.db.
		Where("stream = ?", stream).
		Order("id asc").
		Find(&evts).Error; err != nil {
		return nil, err
	}
	if len(evts) == 0 {
		return nil, ErrStreamNotFound
	}
	return es.decodeEvts(evts)
}
func ( es * EventStore ) ReadStream ( ctx context . Context , stream string ) ( [ ] EventData , error ) { var evts [ ] gormEvent if len ( stream ) == 0 { return nil , fmt . Errorf ( " " ) } if err := es . db . Where ( " " , stream ) . Order ( " " ) . Find ( & evts ) . Error ; err != nil { return nil , err } if len ( evts ) == 0 { return nil , ErrStreamNotFound } return es . decodeEvts ( evts ) }
ReadStream will read all events associated with provided stream
If there are no events stored for a given stream ErrStreamNotFound will be returned
ReadStream will read all events associated with provided stream If there are no events stored for a given stream ErrStreamNotFound will be returned