internal/storage/postgres/storage.go
func (s *Storage) Get(ctx context.Context, accessToken string) (*mnemosynerpc.Session, error) {
	span, ctx := opentracing.StartSpanFromContext(ctx, "postgres.storage.get")
	defer span.Finish()

	var entity sessionEntity
	start := time.Now()
	labels := prometheus.Labels{"query": "get"}

	err := s.db.QueryRowContext(ctx, s.queryGet, accessToken).Scan(
		&entity.RefreshToken,
		&entity.SubjectID,
		&entity.SubjectClient,
		&entity.Bag,
		&entity.ExpireAt,
	)
	s.incQueries(labels, start)
	if err != nil {
		s.incError(labels)
		if err == sql.ErrNoRows {
			return nil, storage.ErrSessionNotFound
		}
		return nil, err
	}

	expireAt, err := ptypes.TimestampProto(entity.ExpireAt)
	if err != nil {
		return nil, err
	}
	return &mnemosynerpc.Session{
		AccessToken:   accessToken,
		RefreshToken:  entity.RefreshToken,
		SubjectId:     entity.SubjectID,
		SubjectClient: entity.SubjectClient,
		Bag:           entity.Bag,
		ExpireAt:      expireAt,
	}, nil
}
func (s *Storage) Get(ctx context.Context, accessToken string) (*mnemosynerpc.Session, error) {
	span, ctx := opentracing.StartSpanFromContext(ctx, "postgres.storage.get")
	defer span.Finish()

	var entity sessionEntity
	start := time.Now()
	labels := prometheus.Labels{"query": "get"}

	err := s.db.QueryRowContext(ctx, s.queryGet, accessToken).Scan(
		&entity.RefreshToken,
		&entity.SubjectID,
		&entity.SubjectClient,
		&entity.Bag,
		&entity.ExpireAt,
	)
	s.incQueries(labels, start)
	if err != nil {
		s.incError(labels)
		if err == sql.ErrNoRows {
			return nil, storage.ErrSessionNotFound
		}
		return nil, err
	}

	expireAt, err := ptypes.TimestampProto(entity.ExpireAt)
	if err != nil {
		return nil, err
	}
	return &mnemosynerpc.Session{
		AccessToken:   accessToken,
		RefreshToken:  entity.RefreshToken,
		SubjectId:     entity.SubjectID,
		SubjectClient: entity.SubjectClient,
		Bag:           entity.Bag,
		ExpireAt:      expireAt,
	}, nil
}
// Get implements storage interface.