generators

package
v0.0.0-...-ca5f1ce Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 12 Imported by: 10

Documentation

Overview

Copyright 2020 The Knative Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultNameSystem

func DefaultNameSystem() string

DefaultNameSystem returns the default name system for ordering the types to be processed by the generators in this package.

func NameSystems

func NameSystems() namer.NameSystems

NameSystems returns the name system used by the generators in this package.

func Packages

func Packages(context *generator.Context, arguments *args.GeneratorArgs) generator.Packages

Packages makes the client package definition.

Types

type CommentTag

type CommentTag map[string][]string

CommentTags maps keys to a list of values

type CommentTags

type CommentTags map[string]CommentTag

CommentsTags maps marker prefixes to a set of tags containing keys and values

func ExtractCommentTags

func ExtractCommentTags(marker string, lines []string) CommentTags

ExtractCommentTags parses comments for lines of the form:

 "marker" + "prefix" + ':' + "key=value,key2=value2".

In the following example the marker is '+' and the prefix is 'foo':
 +foo:key=value1,key2=value2,key=value3

Values are optional; empty map is the default. A tag can be specified more than one time and all values are returned. If the resulting map has an entry for a key, the value (a slice) is guaranteed to have at least 1 element.

Example: if you pass "+" for 'marker', and the following lines are in the comments:

+foo:key=value1,key2=value2,key=value3
+bar

Then this function will return:

 map[string]map[string]string{
   "foo":{
    "key":  []string{"value1", "value3"},
    "key2": []string{"value2"}
   },
   "bar": {},
}

Users are not expected to repeat values.

type ExceptionNamer

type ExceptionNamer struct {
	Exceptions map[string]string
	KeyFunc    func(*types.Type) string

	Delegate namer.Namer
}

ExceptionNamer allows you specify exceptional cases with exact names. This allows you to have control for handling various conflicts, like group and resource names for instance.

func (*ExceptionNamer) Name

func (n *ExceptionNamer) Name(t *types.Type) string

Name provides the requested name for a type.

type Tags

type Tags struct {
	util.Tags

	GenerateDuck       bool
	GenerateReconciler bool
}

Tags represents a genclient configuration for a single type.

func MustParseClientGenTags

func MustParseClientGenTags(lines []string) Tags

MustParseClientGenTags calls ParseClientGenTags but instead of returning error it panics.

func (Tags) NeedsDuckInjection

func (t Tags) NeedsDuckInjection() bool

func (Tags) NeedsInformerInjection

func (t Tags) NeedsInformerInjection() bool

func (Tags) NeedsReconciler

func (t Tags) NeedsReconciler(kind *types.Type, args *informergenargs.CustomArgs) bool

Jump to

Keyboard shortcuts

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