gogenerate

package
v0.33.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: MIT Imports: 1 Imported by: 0

README

CLI example

Code you write is - client.go and options.go. To generate options_generated.go you can just go generate like that:

go install github.com/kazhuravlev/options-gen/cmd/options-gen@latest

git clone git@github.com:kazhuravlev/options-gen.git
cd options-gen/examples/go-generate-generics

go generate ./...

Documentation

Overview

Code generated by options-gen. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func New

func New[K comparable, V any](opts Options[K, V]) (*Client[K, V], error)

func (*Client[K, V]) Get

func (c *Client[K, V]) Get(key K) V

func (*Client[K, V]) Set

func (c *Client[K, V]) Set(key K, val V)

type OptOptionsSetter

type OptOptionsSetter[K comparable, V any] func(o *Options[K, V])

func WithDefaultVal

func WithDefaultVal[K comparable, V any](opt V) OptOptionsSetter[K, V]

type Options

type Options[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewOptions

func NewOptions[K comparable, V any](
	options ...OptOptionsSetter[K, V],
) Options[K, V]

func (*Options[K, V]) Validate

func (o *Options[K, V]) Validate() error

Jump to

Keyboard shortcuts

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