codebase

package
v0.0.0-...-ef83997 Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RepositoryKey = "repository"
	BranchKey     = "branch"
	FileNameKey   = "filename"
	LineNumberKey = "linenumber"
	CodebaseIDKey = "codebaseid"
)

Following keys define attribute names in the map of Codebase

Variables

This section is empty.

Functions

This section is empty.

Types

type Codebase

type Codebase struct {
	gormsupport.Lifecycle
	ID                uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key"` // This is the ID PK field
	SpaceID           uuid.UUID `sql:"type:uuid"`
	Type              string
	URL               string
	StackID           *string
	LastUsedWorkspace string
}

Codebase describes a single codebase

func (Codebase) TableName

func (m Codebase) TableName() string

TableName overrides the table name settings in Gorm to force a specific table name in the database.

type Content

type Content struct {
	Repository string `json:"repository"`
	Branch     string `json:"branch"`
	FileName   string `json:"filename"`
	LineNumber int    `json:"linenumber"`
	CodebaseID string `json:"codebaseid"`
}

Content defines all parameters those are useful to associate Che Editor's window to a WI

func NewCodebaseContent

func NewCodebaseContent(value map[string]interface{}) (Content, error)

NewCodebaseContent builds Content instance from input Map.

func NewCodebaseContentFromValue

func NewCodebaseContentFromValue(value interface{}) (*Content, error)

NewCodebaseContentFromValue builds Content from interface{}

func (*Content) IsRepoValidURL

func (c *Content) IsRepoValidURL() bool

IsRepoValidURL makes sure Repo is valid GIT URL

func (*Content) IsValid

func (c *Content) IsValid() error

IsValid perform following checks Repository value is mandatory

func (*Content) ToMap

func (c *Content) ToMap() map[string]interface{}

ToMap converts Content to a map of string->Interface{}

type GormCodebaseRepository

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

GormCodebaseRepository is the implementation of the storage interface for Codebases.

func (*GormCodebaseRepository) CheckExists

func (m *GormCodebaseRepository) CheckExists(ctx context.Context, id uuid.UUID) error

CheckExists returns nil if the given ID exists otherwise returns an error

func (*GormCodebaseRepository) Create

func (m *GormCodebaseRepository) Create(ctx context.Context, codebase *Codebase) error

Create creates a new record.

func (*GormCodebaseRepository) Delete

func (m *GormCodebaseRepository) Delete(ctx context.Context, ID uuid.UUID) error

Delete deletes the codebase with the given id returns NotFoundError or InternalError

func (*GormCodebaseRepository) List

func (m *GormCodebaseRepository) List(ctx context.Context, spaceID uuid.UUID, start *int, limit *int) ([]Codebase, int, error)

List all codebases related to a single item

func (*GormCodebaseRepository) Load

Load a single codebase regardless of parent

func (*GormCodebaseRepository) LoadByRepo

func (m *GormCodebaseRepository) LoadByRepo(ctx context.Context, spaceID uuid.UUID, repository string) (*Codebase, error)

LoadByRepo returns a single codebase found for input repository url

func (*GormCodebaseRepository) Save

func (m *GormCodebaseRepository) Save(ctx context.Context, codebase *Codebase) (*Codebase, error)

Save a single codebase

func (*GormCodebaseRepository) SearchByURL

func (m *GormCodebaseRepository) SearchByURL(ctx context.Context, url string, start *int, limit *int) ([]Codebase, int, error)

SearchByURL searches for codebases that match the given URL

type Repository

type Repository interface {
	repository.Exister
	Create(ctx context.Context, u *Codebase) error
	Delete(ctx context.Context, ID uuid.UUID) error
	Save(ctx context.Context, codebase *Codebase) (*Codebase, error)
	List(ctx context.Context, spaceID uuid.UUID, start *int, limit *int) ([]Codebase, int, error)
	Load(ctx context.Context, id uuid.UUID) (*Codebase, error)
	LoadByRepo(ctx context.Context, spaceID uuid.UUID, repository string) (*Codebase, error)
	SearchByURL(ctx context.Context, url string, start *int, limit *int) ([]Codebase, int, error)
}

Repository describes interactions with codebases

func NewCodebaseRepository

func NewCodebaseRepository(db *gorm.DB) Repository

NewCodebaseRepository creates a new storage type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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