func (s Store) GetByID(ctx context.Context, ids []int) (map[int]*entity.Role, error) {
	var indicators []*entity.Role
	query, params, err := sq.Select("*").From("roles").Where(sq.Eq{"id": util.UniqueInts(ids)}).ToSql()
	if err != nil {
		return nil, errors.WithStack(err)
	}
	err = s.db.SelectContext(ctx, &indicators, query, params...)
	if err != nil {
		return nil, errors.WithStack(err)
	}
	result := make(map[int]*entity.Role, len(indicators))
	for _, item := range indicators {
		result[item.ID] = item
	}
	return result, errors.WithStack(err)
}
GetByID returns entities by ID.
package role
import (
	"context"
	"database/sql"
	"go-webapp-example/internal/pkg/entity"
	"go-webapp-example/pkg/clock"
	"go-webapp-example/pkg/db"
	"go-webapp-example/pkg/util"
	"github.com/pkg/errors"
	"gopkg.in/guregu/null.v3"
	sq "github.com/Masterminds/squirrel"
)
type authManager interface {
	DeleteRole(roleID int)
	AddRolePermission(roleID int, code string, s string) bool
	AddRoleForUser(userID int, roleID int) bool
	RemoveRoleForUser(userID int, roleID int) bool
}
type Store struct {
	db    *db.Connection
	clock *clock.Clock
	auth  authManager
}
func NewStore(conn *db.Connection, auth authManager, opts ...func(s *Store)) *Store {
	s := &Store{db: conn, auth: auth}
	for _, opt := range opts {
		opt(s)
	}
	return s
}
func (s Store) Find(ctx context.Context, id int) (*entity.Role, error) {
	var role entity.Role
	err := s.db.GetContext(ctx, &role, "SELECT * FROM roles WHERE id = ? LIMIT 1", id)
	return &role, errors.WithStack(checkNotFound(err))
}
func (s Store) Get(ctx context.Context) ([]*entity.Role, error) {
	var roles []*entity.Role
	err := s.db.SelectContext(ctx, &roles, "SELECT * FROM roles")
	return roles, errors.WithStack(err)
}