SkillAgentSearch skills...

Constraints

๐Ÿฆ– Drop-in replacement for golang.org/x/exp/constraints with more predefined constraints

Install / Use

/learn @atomicgo/Constraints
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<!-- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ IMPORTANT NOTE โ”‚ โ”‚ โ”‚ โ”‚ This file is automatically generated โ”‚ โ”‚ All manual modifications will be overwritten โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ --> <h1 align="center">AtomicGo | constraints</h1> <p align="center"> <img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fatomicgo.dev%2Fapi%2Fshields%2Fconstraints&style=flat-square" alt="Downloads"> <a href="https://github.com/atomicgo/constraints/releases"> <img src="https://img.shields.io/github/v/release/atomicgo/constraints?style=flat-square" alt="Latest Release"> </a> <a href="https://codecov.io/gh/atomicgo/constraints" target="_blank"> <img src="https://img.shields.io/github/actions/workflow/status/atomicgo/constraints/go.yml?style=flat-square" alt="Tests"> </a> <a href="https://codecov.io/gh/atomicgo/constraints" target="_blank"> <img src="https://img.shields.io/codecov/c/gh/atomicgo/constraints?color=magenta&logo=codecov&style=flat-square" alt="Coverage"> </a> <a href="https://codecov.io/gh/atomicgo/constraints"> <!-- unittestcount:start --><img src="https://img.shields.io/badge/Unit_Tests-126-magenta?style=flat-square" alt="Unit test count"><!-- unittestcount:end --> </a> <a href="https://opensource.org/licenses/MIT" target="_blank"> <img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square" alt="License: MIT"> </a> <a href="https://goreportcard.com/report/github.com/atomicgo/constraints" target="_blank"> <img src="https://goreportcard.com/badge/github.com/atomicgo/constraints?style=flat-square" alt="Go report"> </a> </p>
<p align="center"> <strong><a href="https://pkg.go.dev/atomicgo.dev/constraints#section-documentation" target="_blank">Documentation</a></strong> | <strong><a href="https://github.com/atomicgo/atomicgo/blob/main/CONTRIBUTING.md" target="_blank">Contributing</a></strong> | <strong><a href="https://github.com/atomicgo/atomicgo/blob/main/CODE_OF_CONDUCT.md" target="_blank">Code of Conduct</a></strong> </p>
<p align="center"> <img src="https://raw.githubusercontent.com/atomicgo/atomicgo/main/assets/header.png" alt="AtomicGo"> </p> <p align="center"> <table> <tbody> </tbody> </table> </p> <h3 align="center"><pre>go get atomicgo.dev/constraints</pre></h3> <p align="center"> <table> <tbody> </tbody> </table> </p> <!-- gomarkdoc:embed:start --> <!-- Code generated by gomarkdoc. DO NOT EDIT -->

constraints

import "atomicgo.dev/constraints"

Package constraints provides constraints for type parameters aka. generics in Go.

This is a more comprehensive drop-in replacement for golang.org/x/exp/constraints.

Index

<a name="Addable"></a>

type Addable

Addable is a constraint that matches any type that can be added with the + operator.

type Addable interface {
    Number | ~string
}

<a name="Comparable"></a>

type Comparable

Comparable is a constraint that matches any type that can be compared with the == and != operators.

type Comparable interface {
    comparable
}

<a name="Complex"></a>

type Complex

Complex is a constraint that matches any complex number type.

type Complex interface {
    ~complex64 | ~complex128
}

<a name="Float"></a>

type Float

Float is a constraint that matches any floating point number type.

type Float interface {
    ~float32 | ~float64
}

<a name="Integer"></a>

type Integer

Integer is a constraint that matches any integer type.

type Integer interface {
    Signed | Unsigned
}

<a name="Number"></a>

type Number

Number is a constraint that matches any real number type. The Number constraint does not include Complex numbers, as those are not ordered. If you also need Complex numbers, use the Numeric constraint.

type Number interface {
    Float | Integer
}

<a name="Numeric"></a>

type Numeric

Numeric is a constraint that matches any numeric type, including complex numbers.

type Numeric interface {
    Number | Complex
}

<a name="Orderable"></a>

type Orderable

Orderable is a constraint that matches any type that can be ordered with the <, <=, >, and >= operators.

type Orderable interface {
    Integer | Float | ~string
}

<a name="Ordered"></a>

type Ordered

Ordered is a constraint that matches any ordered type.

type Ordered interface {
    Integer | Float | ~string
}

<a name="Signed"></a>

type Signed

Signed is a constraint that matches any signed integer type.

type Signed interface {
    ~int | ~int8 | ~int16 | ~int32 | ~int64
}

<a name="Unsigned"></a>

type Unsigned

Unsigned is a constraint that matches any unsigned integer type.

type Unsigned interface {
    ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

Generated by gomarkdoc

<!-- gomarkdoc:embed:end -->

AtomicGo.dev ย ยทย  with โค๏ธ by @MarvinJWendt | MarvinJWendt.com

Related Skills

View on GitHub
GitHub Stars4
CategoryDevelopment
Updated8mo ago
Forks0

Languages

Go

Security Score

82/100

Audited on Jul 25, 2025

No findings