interfaces

package
v0.0.0-...-a602e0b Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrMsgNotFound is the error message for when a resource is not found
	ErrMsgNotFound = "not found"
	// ErrMsgSaveFailed is the error message for when a save operation fails
	ErrMsgSaveFailed = "save failed"
)

Variables

View Source
var (
	// ErrNotFound is an error for when a resource is not found
	ErrNotFound = errors.New(ErrMsgNotFound)
	// ErrSaveFailed is an error for when a save operation fails
	ErrSaveFailed = errors.New(ErrMsgSaveFailed)
)

Functions

This section is empty.

Types

type GrpcServer

type GrpcServer interface {
	// Serve starts the gRPC server
	// - net.Listener: the listener to bind the server to
	// returns an error if the server fails to start
	Serve(net.Listener) error
	// GracefulStop stops the gRPC server gracefully
	GracefulStop()
}

GrpcServer is an interface for gRPC server

type IConfig

type IConfig interface {
	// GetDatabasePath returns the database path
	GetDatabasePath() string
	GetServerAddress() string
	GetServerPort() uint16
	GetServerCert() string
	GetServerKey() string
	GetServerCA() string
	IsTLSEnabled() bool
}

IConfig is an interface for configuration

type INumberRepository

type INumberRepository interface {
	// Save saves a number
	// - number: the number to save
	// Returns an error if the save operation fails
	Save(number Number) error
	// FindByID finds a number by its ID
	// - id: the ID of the number to find
	// Returns the number if found, otherwise returns an error
	FindByID(id string) (*Number, error)
	// DeleteByID deletes a number by its ID
	// - id: the ID of the number to delete
	// Returns an error if the delete operation fails
	DeleteByID(id string) error
}

INumberRepository is an interface for number repositories

type Number

type Number struct {
	// ID is the unique identifier of the number
	ID string
	// Number is the value of the number
	Number uint64
}

Number is a struct to represent a number

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳