agent

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrAgentNameAlreadyInUse = "an agent already exists with this name"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	ID             uuid.UUID                 `gorm:"type:uuid;default:gen_random_uuid()" json:"id"`
	CreatedAt      time.Time                 `json:"created_at"`
	UpdatedAt      time.Time                 `json:"updated_at"`
	DeletedAt      *time.Time                `sql:"index" json:"deleted_at"`
	Name           string                    `gorm:"index:idx_name,unique" json:"name"`
	OrganizationID uuid.UUID                 `gorm:"index:idx_name,unique" json:"organization_id"`
	Organization   organization.Organization `json:"-"`
	Status         string                    `json:"status"`
	OauthClientID  string                    `json:"oauth_client_id"`
	OauthClient    oauth.OauthClient         `json:"-"`
}

type AgentRepository

type AgentRepository interface {
	List(organizationId uuid.UUID) ([]Agent, error)
	FindById(organizationId uuid.UUID, agentId string) (*Agent, error)
	FindByClientId(clientId string) (*Agent, error)
	Create(agent *Agent) (*Agent, error)
	Update(agent *Agent) (*Agent, error)
	Delete(agentId string) error
}

func NewAgentRepository

func NewAgentRepository(db *gorm.DB, clientStore *oauth.ClientStore) AgentRepository

type AgentRepositoryImpl

type AgentRepositoryImpl struct {
	Db          *gorm.DB
	ClientStore *oauth.ClientStore
}

func (AgentRepositoryImpl) Create

func (a AgentRepositoryImpl) Create(agent *Agent) (*Agent, error)

func (AgentRepositoryImpl) Delete

func (a AgentRepositoryImpl) Delete(agentId string) error

func (AgentRepositoryImpl) FindByClientId

func (a AgentRepositoryImpl) FindByClientId(clientId string) (*Agent, error)

func (AgentRepositoryImpl) FindById

func (a AgentRepositoryImpl) FindById(organizationId uuid.UUID, agentId string) (*Agent, error)

func (AgentRepositoryImpl) List

func (a AgentRepositoryImpl) List(organizationId uuid.UUID) ([]Agent, error)

func (AgentRepositoryImpl) Update

func (a AgentRepositoryImpl) Update(agent *Agent) (*Agent, error)

Jump to

Keyboard shortcuts

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