domain

package
v0.39.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RootSub = "root"
	OrgSub  = "org"
)

Subject type constants for authorization.

View Source
const (
	OrgAdmin  = "admin"
	OrgOwner  = "owner"
	OrgEditor = "editor"
	OrgViewer = "viewer"
)

Org role constants.

View Source
const (
	// RoleRootAdmin is the super admin role.
	RoleRootAdmin = "root"
	// RoleAdmin is the admin role.
	RoleAdmin = "admin"
)

Platform role constants.

View Source
const (
	LoginKey uint32 = iota
	RecoveryKey
	APIKey
)

Key type constants.

View Source
const (
	KeyTypeInternal = "internal"
	KeyTypeExternal = "external"
)

Thing key type constants.

View Source
const (
	GroupViewer = "viewer"
	GroupEditor = "editor"
	GroupAdmin  = "admin"
	GroupOwner  = "owner"
)

Group role constants.

View Source
const (
	EnabledStatusKey  = "enabled"
	DisabledStatusKey = "disabled"
	AllStatusKey      = "all"
)

Status key constants for user filtering.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthzReq

type AuthzReq struct {
	Token   string
	Object  string
	Subject string
	Action  string
}

AuthzReq represents an argument struct for authorization requests.

type Config

type Config struct {
	ContentType string      `json:"content_type"`
	Transformer Transformer `json:"transformer"`
}

Config represents profile configuration.

type Group

type Group struct {
	ID          string    `json:"id,omitempty"`
	OrgID       string    `json:"org_id,omitempty"`
	Name        string    `json:"name,omitempty"`
	Description string    `json:"description,omitempty"`
	Metadata    Metadata  `json:"metadata,omitempty"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

Group represents group information.

type GroupInvite

type GroupInvite struct {
	GroupID    string `json:"group_id,omitempty"`
	MemberRole string `json:"member_role,omitempty"`
}

GroupInvite represents a group membership invite.

type GroupMembership

type GroupMembership struct {
	GroupID  string `json:"group_id,omitempty"`
	MemberID string `json:"member_id,omitempty"`
	Email    string `json:"email,omitempty"`
	Role     string `json:"role,omitempty"`
}

GroupMembership represents a group membership.

type GroupMembershipsPage

type GroupMembershipsPage struct {
	Total            uint64            `json:"total"`
	GroupMemberships []GroupMembership `json:"group_memberships"`
}

GroupMembershipsPage contains page metadata and list of group memberships.

type GroupPage

type GroupPage struct {
	Total  uint64  `json:"total"`
	Groups []Group `json:"groups"`
}

GroupPage contains page metadata and list of groups.

type Identity

type Identity struct {
	ID    string `json:"id,omitempty"`
	Email string `json:"email,omitempty"`
}

Identity contains ID and Email.

type JSONMessagesPage

type JSONMessagesPage struct {
	JSONPageMetadata
	MessagesPage
}

JSONMessagesPage contains a page of JSON messages.

type JSONPageMetadata

type JSONPageMetadata struct {
	Offset      uint64   `json:"offset"`
	Limit       uint64   `json:"limit"`
	Subtopic    string   `json:"subtopic,omitempty"`
	Publisher   string   `json:"publisher,omitempty"`
	Protocol    string   `json:"protocol,omitempty"`
	From        int64    `json:"from,omitempty"`
	To          int64    `json:"to,omitempty"`
	Filter      string   `json:"filter,omitempty"`
	AggInterval string   `json:"agg_interval,omitempty"`
	AggValue    uint64   `json:"agg_value,omitempty"`
	AggType     string   `json:"agg_type,omitempty"`
	AggFields   []string `json:"agg_fields,omitempty"`
	Dir         string   `json:"dir,omitempty"`
}

JSONPageMetadata represents the parameters used to create database queries.

type Key

type Key struct {
	ID        string    `json:"id,omitempty"`
	Type      uint32    `json:"type,omitempty"`
	IssuerID  string    `json:"issuer_id,omitempty"`
	Subject   string    `json:"subject,omitempty"`
	IssuedAt  time.Time `json:"issued_at,omitempty"`
	ExpiresAt time.Time `json:"expires_at,omitempty"`
}

Key represents API key.

func (Key) Expired

func (k Key) Expired() bool

Expired reports whether the key is expired.

type KeysPage

type KeysPage struct {
	Total uint64
	Keys  []Key
}

KeysPage contains page metadata and list of keys.

type Message

type Message any

Message represents any message format.

type MessagesPage

type MessagesPage struct {
	Total    uint64
	Messages []Message
}

MessagesPage contains a page of messages.

type Metadata

type Metadata map[string]any

Metadata defines custom key-value metadata used across domain entities.

type Org

type Org struct {
	ID          string    `json:"id,omitempty"`
	OwnerID     string    `json:"owner_id,omitempty"`
	Name        string    `json:"name,omitempty"`
	Description string    `json:"description,omitempty"`
	Metadata    Metadata  `json:"metadata,omitempty"`
	CreatedAt   time.Time `json:"created_at,omitempty"`
	UpdatedAt   time.Time `json:"updated_at,omitempty"`
}

Org represents org information.

type OrgAccessReq

type OrgAccessReq struct {
	OrgID string
	Token string
}

OrgAccessReq represents an org access request.

type OrgInvite

type OrgInvite struct {
	ID           string        `json:"id,omitempty"`
	OrgID        string        `json:"org_id,omitempty"`
	OrgName      string        `json:"org_name,omitempty"`
	InviteeRole  string        `json:"invitee_role,omitempty"`
	GroupInvites []GroupInvite `json:"group_invites,omitempty"`
	InviteeID    string        `json:"invitee_id,omitempty"`
	InviteeEmail string        `json:"invitee_email,omitempty"`
	InviterID    string        `json:"inviter_id,omitempty"`
	InviterEmail string        `json:"inviter_email,omitempty"`
	CreatedAt    time.Time     `json:"created_at,omitempty"`
	ExpiresAt    time.Time     `json:"expires_at,omitempty"`
	State        string        `json:"state,omitempty"`
}

OrgInvite represents org invite information.

type OrgInvitesPage

type OrgInvitesPage struct {
	Invites []OrgInvite `json:"invites"`
	Total   uint64      `json:"total"`
}

OrgInvitesPage contains page metadata and list of org invites.

type OrgMembership

type OrgMembership struct {
	MemberID  string    `json:"member_id,omitempty"`
	OrgID     string    `json:"org_id,omitempty"`
	Role      string    `json:"role,omitempty"`
	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	Email     string    `json:"email,omitempty"`
}

OrgMembership represents org membership information.

type OrgMembershipsPage

type OrgMembershipsPage struct {
	Total          uint64          `json:"total"`
	OrgMemberships []OrgMembership `json:"org_memberships"`
}

OrgMembershipsPage contains page metadata and list of org memberships.

type OrgsPage

type OrgsPage struct {
	Total uint64 `json:"total"`
	Orgs  []Org  `json:"orgs"`
}

OrgsPage contains page metadata and list of orgs.

type PlatformInvite

type PlatformInvite struct {
	ID           string     `json:"id,omitempty"`
	InviteeEmail string     `json:"invitee_email,omitempty"`
	CreatedAt    time.Time  `json:"created_at,omitempty"`
	ExpiresAt    time.Time  `json:"expires_at,omitempty"`
	State        string     `json:"state,omitempty"`
	OrgInvite    *OrgInvite `json:"org_invite"`
}

PlatformInvite represents platform invite information.

type PlatformInvitesPage

type PlatformInvitesPage struct {
	Total   uint64           `json:"total"`
	Invites []PlatformInvite `json:"invites"`
}

PlatformInvitesPage contains page metadata and list of platform invites.

type Profile

type Profile struct {
	ID       string         `json:"id,omitempty"`
	GroupID  string         `json:"group_id,omitempty"`
	Name     string         `json:"name,omitempty"`
	Config   map[string]any `json:"config,omitempty"`
	Metadata Metadata       `json:"metadata,omitempty"`
}

Profile represents a communication group (things that can exchange messages).

type ProfilesPage

type ProfilesPage struct {
	Total    uint64    `json:"total"`
	Profiles []Profile `json:"profiles"`
}

ProfilesPage contains page metadata and list of profiles.

type PubConfigInfo

type PubConfigInfo struct {
	PublisherID   string
	ProfileConfig map[string]any
}

PubConfigInfo represents publisher config from GetPubConfigByKey.

type SenMLMessagesPage

type SenMLMessagesPage struct {
	SenMLPageMetadata
	MessagesPage
}

SenMLMessagesPage contains a page of SenML messages.

type SenMLPageMetadata

type SenMLPageMetadata struct {
	Offset      uint64   `json:"offset"`
	Limit       uint64   `json:"limit"`
	Subtopic    string   `json:"subtopic,omitempty"`
	Publisher   string   `json:"publisher,omitempty"`
	Protocol    string   `json:"protocol,omitempty"`
	Name        string   `json:"name,omitempty"`
	Value       float64  `json:"v,omitempty"`
	Comparator  string   `json:"comparator,omitempty"`
	BoolValue   bool     `json:"vb,omitempty"`
	StringValue string   `json:"vs,omitempty"`
	DataValue   string   `json:"vd,omitempty"`
	From        int64    `json:"from,omitempty"`
	To          int64    `json:"to,omitempty"`
	AggInterval string   `json:"agg_interval,omitempty"`
	AggValue    uint64   `json:"agg_value,omitempty"`
	AggType     string   `json:"agg_type,omitempty"`
	AggFields   []string `json:"agg_fields,omitempty"`
	Dir         string   `json:"dir,omitempty"`
}

SenMLPageMetadata represents the parameters used to create database queries.

type Thing

type Thing struct {
	ID          string   `json:"id,omitempty"`
	GroupID     string   `json:"group_id,omitempty"`
	ProfileID   string   `json:"profile_id,omitempty"`
	Name        string   `json:"name,omitempty"`
	Type        string   `json:"type,omitempty"`
	Key         string   `json:"key,omitempty"`
	ExternalKey string   `json:"external_key,omitempty"`
	Metadata    Metadata `json:"metadata,omitempty"`
}

Thing represents a Mainflux thing. Each thing is owned by one user, and it is assigned with the unique identifier and (temporary) access key.

type ThingAccessReq

type ThingAccessReq struct {
	ThingKey
	ID string
}

ThingAccessReq represents a thing access request.

type ThingCommandReq

type ThingCommandReq struct {
	PublisherID string
	RecipientID string
}

ThingCommandReq represents a request to authorize an inter-thing command.

type ThingGroupCommandReq

type ThingGroupCommandReq struct {
	PublisherID string
	GroupID     string
}

ThingGroupCommandReq represents a request to authorize a thing group command.

type ThingKey

type ThingKey struct {
	Value string `json:"key"`
	Type  string `json:"type"`
}

ThingKey represents a Thing authentication key and its type.

type ThingsPage

type ThingsPage struct {
	Total  uint64  `json:"total"`
	Things []Thing `json:"things"`
}

ThingsPage contains page related metadata as well as list of things that belong to this page.

type Transformer

type Transformer struct {
	DataFilters  []string `json:"data_filters"`
	DataField    string   `json:"data_field"`
	TimeField    string   `json:"time_field"`
	TimeFormat   string   `json:"time_format"`
	TimeLocation string   `json:"time_location"`
}

Transformer represents message transformation config.

type User

type User struct {
	ID       string   `json:"id,omitempty"`
	Email    string   `json:"email,omitempty"`
	Password string   `json:"password,omitempty"`
	Metadata Metadata `json:"metadata,omitempty"`
	Status   string   `json:"status,omitempty"`
	Role     string   `json:"role,omitempty"`
}

User represents user account information.

func (User) Validate

func (u User) Validate(passRegex *regexp.Regexp) error

Validate returns an error if user representation is invalid.

type UserAccessReq

type UserAccessReq struct {
	Token  string
	ID     string
	Action string
}

UserAccessReq represents a user access request.

type UsersPage

type UsersPage struct {
	Total uint64 `json:"total"`
	Users []User `json:"users"`
}

UsersPage contains page metadata and list of users.

Jump to

Keyboard shortcuts

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