func (r *Rights) Scan(src interface{}) error {
	var ints pq.Int64Array
	if err := ints.Scan(src); err != nil {
		return err
	}
	rights := make([]ttnpb.Right, len(ints))
	for i, right := range ints {
		rights[i] = ttnpb.Right(right)
	}
	*r = Rights{Rights: rights}
	return nil
}
Scan reads the value from the database into the Rights.
package store
import (
	"database/sql/driver"
	"fmt"
	"github.com/lib/pq"
	"go.thethings.network/lorawan-stack/v3/pkg/ttnpb"
	"go.thethings.network/lorawan-stack/v3/pkg/types"
)
type EUI64 types.EUI64
var zeroEUI64 EUI64
func (eui EUI64) Value() (driver.Value, error) {
	return types.EUI64(eui).String(), nil
}
func eui(eui *types.EUI64) *EUI64 {
	if eui == nil {
		return nil
	}
	converted := EUI64(*eui)
	return &converted
}
func (eui *EUI64) toPB() *types.EUI64 {
	if eui == nil {
		return nil
	}
	converted := types.EUI64(*eui)
	return &converted
}
func (eui *EUI64) Scan(src interface{}) error {
	var (
		dto types.EUI64
		err error
	)
	switch src := src.(type) {
	case []byte:
		err = dto.UnmarshalText(src)
	case string:
		err = dto.UnmarshalText([]byte(src))
	case nil:
		*eui = EUI64{}
	default:
		err = fmt.Errorf("cannot convert %T to EUI64", src)
	}
	if err != nil {
		return err
	}
	*eui = EUI64(dto)
	return nil
}
type Grants []ttnpb.GrantType
func (g Grants) Value() (driver.Value, error) {
	ints := make([]int64, len(g))
	for i, grant := range g {
		ints[i] = int64(grant)
	}
	return pq.Int64Array(ints).Value()
}
func (g *Grants) Scan(src interface{}) error {
	var ints pq.Int64Array
	if err := ints.Scan(src); err != nil {
		return err
	}
	grants := make(Grants, len(ints))
	for i, grant := range ints {
		grants[i] = ttnpb.GrantType(grant)
	}
	*g = grants
	return nil
}
type Rights ttnpb.Rights
func (r Rights) Value() (driver.Value, error) {
	ints := make([]int64, len(r.Rights))
	for i, right := range r.Rights {
		ints[i] = int64(right)
	}
	return pq.Int64Array(ints).Value()
}