factorypattern

package
v0.0.0-...-0a00fa3 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEmployeeFactory

func NewEmployeeFactory(age, salary int) func(name string) *Employee

Types

type CryptographyAlgorithm

type CryptographyAlgorithm interface {
	GenerateHash(w io.Writer, msg []byte)
}

The Factory Design Pattern is a creational design pattern that provides an interface for creating objects in a superclass, but allows subclasses to alter the type of objects that will be created. The Factory Design Pattern is used when a class cannot anticipate the type of objects it needs to create, or when a class wants its subclasses to be able to specify the objects it creates.

type CryptographyAlgorithmType

type CryptographyAlgorithmType int
const (
	SHA256 CryptographyAlgorithmType = iota + 1
	SHA512
)

type Employee

type Employee struct {
	Name   string
	Age    int
	Salary int
}

func GetEmployee

func GetEmployee(name string, age, salary int) *Employee

type SHA256Algorithm

type SHA256Algorithm struct {
}

func (*SHA256Algorithm) GenerateHash

func (s *SHA256Algorithm) GenerateHash(w io.Writer, msg []byte)

type SHA512Algorithm

type SHA512Algorithm struct {
}

func (*SHA512Algorithm) GenerateHash

func (s *SHA512Algorithm) GenerateHash(w io.Writer, msg []byte)

Jump to

Keyboard shortcuts

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