services

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FindOptions added in v1.3.2

type FindOptions struct {
	Limit int
	Page  int
}

FindOptions type defines options for limiting and paging search results.

Property

  • Limit: property is an integer that specifies the maximum number of results to be returned by a search or query. It is often used in conjunction with the `Page` property to implement pagination. For example, if `Limit` is set to 10 and there are 50 results, the
  • Page: property is an integer that represents the current page number in a paginated result set. It is often used in combination with the `Limit` property to determine which subset of data to return. For example, if `Limit` is set to 10 and `Page` is set

type Gitlab

type Gitlab interface {
	Save(rulesheet *dtos.Rulesheet, commitMessage string) error
	Fill(rulesheet *dtos.Rulesheet) error
	Connect() (*gitlab.Client, error)
}

Gitlab interface defines methods for saving, filling, and connecting to a Gitlab client.

Property:

  • Save: A method that takes a pointer to a Rulesheet DTO (Data Transfer Object) and a commit message as input parameters and returns an error. This method is responsible for saving the Rulesheet to Gitlab repository with the provided commit message.
  • Fill: The method is a function that takes a pointer to a `Rulesheet` DTO and fills it with data from a GitLab repository. It returns an error if there's any issue while filling the `Rulesheet`.
  • Connect: Connect is a method that returns a pointer to a gitlab.Client and an error. It's used to establish a connection to the GitLab server.

func NewGitlab

func NewGitlab(cfg *config.Config) Gitlab

NewGitlab creates a new instance of the Gitlab service using the provided configuration.

type Rulesheets

type Rulesheets interface {
	Create(context.Context, *dtos.Rulesheet) error
	Find(ctx context.Context, filter interface{}, options *FindOptions) ([]*dtos.Rulesheet, error)
	Count(ctx context.Context, entity interface{}) (count int64, err error)
	Get(ctx context.Context, id string) (*dtos.Rulesheet, error)
	Update(ctx context.Context, entity dtos.Rulesheet) (*dtos.Rulesheet, error)
	Delete(ctx context.Context, id string) (bool, error)
}

Rulesheets defines an interface for CRUD operations on rulesheets. Property:

  • Create: Create is a method that creates a new rulesheet in the database. It takes a context and a pointer to a dtos.Rulesheet object as input and returns an error if the operation fails.
  • Find: method is used to retrieve a list of Rulesheets based on a filter and options. The filter parameter is used to specify the criteria for selecting Rulesheets, while the options parameter is used to specify additional options such as sorting and pagination. The method returns a slice of Rulesheet DTOs and
  • Count: method is used to count the number of documents that match a given filter in the database collection. It takes a context.Context object and an entity interface{} as input parameters and returns the count of documents as an int64 and an error object. The entity parameter is used to specify the type of
  • Get: method is used to retrieve a single Rulesheet entity by its unique identifier (id). It takes in a context.Context object and the id of the Rulesheet to be retrieved as parameters, and returns a pointer to the dtos.Rulesheet object and an error object. If the Rulesheet
  • Update: is a method defined in the Rulesheets interface that takes a context.Context and a dtos.Rulesheet entity as input parameters and returns a pointer to a dtos.Rulesheet and an error. This method is used to update an existing rulesheet entity in the data store.
  • Delete: method is used to delete a rulesheet from the database. It takes a context.Context and a string id as input parameters and returns a boolean value and an error. The boolean value indicates whether the deletion was successful or not. The error value indicates any error that occurred during the deletion process.

func NewRulesheets

func NewRulesheets(repository repository.Rulesheets, gitlabService Gitlab) Rulesheets

NewRulesheets creates a new instance of a rulesheets struct with a given repository and Gitlab service.

Jump to

Keyboard shortcuts

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