assetdocs

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("asset not found")
	ErrConflict = errors.New("asset already exists")
)

Functions

This section is empty.

Types

type CreateDocumentationInput

type CreateDocumentationInput struct {
	MRN     string `json:"mrn" validate:"required"`
	Content string `json:"content" validate:"required"`
	Source  string `json:"source" validate:"required"`
}

type Documentation

type Documentation struct {
	ID         string    `json:"id"`
	MRN        string    `json:"mrn"`
	Content    string    `json:"content"`
	Source     string    `json:"source"`
	GlobalDocs []string  `json:"global_docs,omitempty"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
}

type GlobalDocumentation

type GlobalDocumentation struct {
	ID        string    `json:"id"`
	Content   string    `json:"content"`
	Source    string    `json:"source"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type PostgresRepository

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

func (*PostgresRepository) CreateDocumentation

func (r *PostgresRepository) CreateDocumentation(ctx context.Context, doc Documentation) error

func (*PostgresRepository) CreateGlobalDocumentation

func (r *PostgresRepository) CreateGlobalDocumentation(ctx context.Context, doc GlobalDocumentation) error

func (*PostgresRepository) GetDocumentation

func (r *PostgresRepository) GetDocumentation(ctx context.Context, mrn string) ([]Documentation, error)

func (*PostgresRepository) GetGlobalDocumentation

func (r *PostgresRepository) GetGlobalDocumentation(ctx context.Context, source string) (string, error)

type Repository

type Repository interface {
	GetDocumentation(ctx context.Context, mrn string) ([]Documentation, error)
	CreateDocumentation(ctx context.Context, doc Documentation) error
	CreateGlobalDocumentation(ctx context.Context, doc GlobalDocumentation) error
	GetGlobalDocumentation(ctx context.Context, source string) (string, error)
}

func NewPostgresRepository

func NewPostgresRepository(db *pgxpool.Pool) Repository

type Service

type Service interface {
	Get(ctx context.Context, mrn string) ([]Documentation, error)
	Create(ctx context.Context, doc Documentation) error
	CreateGlobal(ctx context.Context, doc GlobalDocumentation) error
	CombineDocumentation(ctx context.Context, docs []Documentation) ([]Documentation, error)
}

func NewService

func NewService(repo Repository, opts ...ServiceOption) Service

type ServiceOption

type ServiceOption func(*service)

Jump to

Keyboard shortcuts

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