Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Hardik180704/Go
/ types & classes
Types & classes
17 in github.com/Hardik180704/Go
⨍
Functions
78
◇
Types & classes
17
TypeAlias
Age
Custom type based on int (works because of ~int)
Generics/main.go:127
Struct
BankAccount
============================================ REAL-WORLD EXAMPLE: Bank Account ============================================
Mutex/main.go:221
Struct
Container
Container is a GENERIC STRUCT [T any] means the struct can hold any type Real-world example: Like a box that can hold toys, books, or clothes
Generics/main.go:64
Struct
Email
============================================ CHANNELS: Communication between goroutines ============================================ Channels are like
Channels/main.go:43
Struct
Employee
nested structs
Structs/main.go:45
Struct
Manager
Struct embedding and methods
Structs/main.go:69
Interface
Number
sumNumbers uses CONSTRAINT INTERFACE with ~ ~int means "any type whose underlying type is int" This includes: int, type MyInt int, type Age int, etc.
Generics/main.go:49
TypeAlias
OrderStatus
OrderStatus is a custom type based on string This creates a "type-safe enum" pattern in Go Type-safe means you can't accidentally use a random string
Enums/main.go:9
Struct
Person
Structs -> custom data types defining a struct
Structs/main.go:7
Struct
User
Packages/user/user.go:3
Struct
payment
payment struct holds a payment gateway The 'gateway' field can be ANY type that implements the paymenter interface This is the power of interfaces - y
Interfaces/main.go:15
Interface
paymenter
paymenter is an interface that defines a contract Any type that wants to be a "paymenter" MUST implement the pay() method This is like a rule book - "
Interfaces/main.go:8
Struct
postRWMutex
============================================ RWMUTEX: Read-Write Mutex 📖✍️ ============================================ Problem with regular Mutex: Re
Mutex/main.go:99
Struct
postSafe
============================================ SOLUTION: Using Mutex ============================================
Mutex/main.go:48
Struct
postUnsafe
============================================ MUTEX: Mutual Exclusion Lock 🔒 ============================================ MUTEX stands for "MUTual EXcl
Mutex/main.go:30
Struct
razorpay
razorpay is an empty struct representing the Razorpay payment gateway
Interfaces/main.go:29
Struct
stripe
stripe is another payment gateway
Interfaces/main.go:39