contactmethod

package
v0.35.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContactMethod

type ContactMethod struct {
	ID       uuid.UUID
	Name     string
	Dest     gadb.DestV1
	Disabled bool
	UserID   string
	Pending  bool
	Private  bool

	StatusUpdates bool
	// contains filtered or unexported fields
}

ContactMethod stores the information for contacting a user.

func (ContactMethod) LastTestVerifyAt added in v0.26.0

func (c ContactMethod) LastTestVerifyAt() time.Time

LastTestVerifyAt will return the timestamp of the last test/verify request.

func (ContactMethod) Normalize

func (c ContactMethod) Normalize(ctx context.Context, reg *nfydest.Registry) (*ContactMethod, error)

Normalize will validate and 'normalize' the ContactMethod -- such as making email lower-case and setting carrier to "" (for non-phone types).

type Metadata added in v0.25.0

type Metadata struct {
	FetchedAt time.Time `json:"-"`

	CarrierV1 struct {
		UpdatedAt         time.Time
		Name              string
		Type              string
		MobileNetworkCode string
		MobileCountryCode string
	}
}

Metadata stores information about a contact method.

func (Metadata) MarshalJSON added in v0.25.0

func (m Metadata) MarshalJSON() ([]byte, error)

MarshalJSON implements `json.Marshaler`. It is used to allow `omitempty` behavior with embedded structs.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store implements the lookup and management of ContactMethods against a *sql.Store backend.

func NewStore added in v0.30.0

func NewStore(reg *nfydest.Registry) *Store

func (*Store) Create added in v0.32.0

func (s *Store) Create(ctx context.Context, dbtx gadb.DBTX, c *ContactMethod) (*ContactMethod, error)

CreateTx inserts the new ContactMethod into the database. A new ID is always created.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, dbtx gadb.DBTX, ids ...string) error

Delete removes the ContactMethod from the database using the provided ID within a transaction.

func (*Store) DisableByDest added in v0.33.0

func (s *Store) DisableByDest(ctx context.Context, dbtx gadb.DBTX, dest gadb.DestV1) error

func (*Store) EnableByDest added in v0.33.0

func (s *Store) EnableByDest(ctx context.Context, dbtx gadb.DBTX, dest gadb.DestV1) error

func (*Store) FindAll

func (s *Store) FindAll(ctx context.Context, dbtx gadb.DBTX, userID string) ([]ContactMethod, int, error)

FindAll finds all contact methods from the database associated with the given user ID along with the number of omitted (private) entries.

func (*Store) FindDestByID added in v0.33.0

func (s *Store) FindDestByID(ctx context.Context, tx gadb.DBTX, id uuid.UUID) (gadb.DestV1, error)

func (*Store) FindMany

func (s *Store) FindMany(ctx context.Context, dbtx gadb.DBTX, ids []string) ([]ContactMethod, error)

FindMany will fetch all contact methods matching the given ids.

func (*Store) FindOne

func (s *Store) FindOne(ctx context.Context, dbtx gadb.DBTX, id uuid.UUID) (*ContactMethod, error)

FindOneTx finds the contact method from the database using the provided ID within a transaction.

func (*Store) MetadataByDest added in v0.33.0

func (s *Store) MetadataByDest(ctx context.Context, dbtx gadb.DBTX, dest gadb.DestV1) (*Metadata, error)

func (*Store) SetCarrierV1MetadataByDest added in v0.33.0

func (s *Store) SetCarrierV1MetadataByDest(ctx context.Context, dbtx gadb.DBTX, dest gadb.DestV1, newM *Metadata) error

func (*Store) Update

func (s *Store) Update(ctx context.Context, dbtx gadb.DBTX, c *ContactMethod) error

UpdateTx updates the contact method with the newly provided values within a transaction.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL