golang实现枚举类型
描述
golang无枚举类型, 但可以借助自定义类型实现
什么是枚举类型
枚举类型是一种类型, 它的值只有有限个. 换而言之, 枚举类型=一个类型+N个离散值
go的实现, 可以自定义一个类型, 把它作为枚举类型, 然后使用该类型定义N个常量.
示例
type FormatType int const ( FTByte FormatType = iota FTArray FTDefine ) func (ft FormatType) String() string { switch ft{ case FTByte: return "byte" case FTArray: return "array" case FTDefine: return "define" } return "" }
2023年8月09日 16:34
I can't wait to share this post with my colleagues. It's a goldmine of insights.
2023年10月22日 13:12
I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. Thanks... ufabetทางเข้าเล่น
2023年11月15日 03:59
The kitchen is my sanctuary, where the magic of ingredients transforms into delightful dishes. It's a space where creativity and flavors collide, turning ordinary foods into extraordinary experiences.
2023年12月05日 01:41
https://darkweb.link/
2023年12月09日 21:19
I am always searching online for articles that can help me. There is obviously a lot to know about this. I think you made some good points in Features also. Keep working, great job ! UFABETกติกาแทงบอล
2024年1月04日 14:46
WellSpa by Nu Skin is not your typical spa experience; it’s a holistic journey that aims to rejuvenate the body, mind, and spirit. Nestled in serene locations around the world, WellSpa offers a haven of tranquility, where cutting-edge science meets ancient relaxation techniques. Click here wellspa nuskin
2024年2月01日 13:04
Experience convenient and reliable transportation with our Taxi services in Walton on Thames. Whether you're heading to the airport or exploring the town, our dedicated team ensures a comfortable and prompt journey. Choose Taxi Walton on Thames for a seamless and stress-free travel experience.
2024年2月04日 18:59
Discover reliable and timely transportation with Taxi in Weybridge. Our service caters to your travel needs in and around Weybridge, offering prompt and comfortable rides. Choose Taxi in Weybridge for a stress-free journey, ensuring you reach your destination with ease and satisfaction.
2024年3月11日 05:07
Fashion is a form of self-expression that allows us to show the world who we are and what we stand for, without having to say a word. alchemai
2024年3月22日 19:00
I think you made some good points in Features also. Keep working, great job ! <a href="https://studioarash.com" rel="external">Wedding Photographers In Toronto</a>
2024年5月09日 20:43
https://kokaindrogekaufen.com/
https://ketaminkaufen.com/
https://mdmakaufen.com/
https://cannaweedzone.com/
https://cannahome.net/
https://grasherr.com/de_de/
https://strongclubmeds.com/
https://floodedpcaks.com/
https://nobupacks.com/
https://gblstores.com/
2024年6月26日 18:33
Transform your look with eyelash extensions in Brooklyn. Our expert technicians provide stunning, long-lasting lashes that enhance your natural beauty. Book your appointment today for the best eyelash extensions Brooklyn has to offer and enjoy effortlessly glamorous eyes.
2024年6月27日 18:27
Achieve a sun-kissed glow with professional spray tanning in Staten Island. Our expert technicians provide flawless, natural-looking results tailored to your skin tone. Book your appointment today for the best spray tanning Staten Island has to offer.
2024年7月07日 17:16
I was surfing net and fortunately came across this site and found very interesting stuff here. Its really fun to read. I enjoyed a lot. Thanks for sharing this wonderful information. OK Win register
2024年7月13日 22:12
Looking to buy Adderall online? Find reliable and legitimate sources for purchasing this medication safely. Ensure a secure and discreet transaction to meet your needs.
2024年7月19日 19:48
Express your personality or promote your brand with custom Adams hats. ApparelnBags brings you a collection of Adams caps at affordable prices.
2024年7月22日 19:20
Looking for where to get organic spray tans? Discover top salons that offer eco-friendly, natural tanning solutions for a flawless, sun-kissed glow. Enjoy a radiant tan with high-quality, skin-friendly ingredients that are gentle on your skin and the environment.
2024年7月24日 12:38
Looking for affordable eyelash extensions in Brooklyn? Discover top salons offering beautiful, long-lasting lash extensions at budget-friendly prices. Find the best places for affordable eyelash extensions in Brooklyn and enhance your look without breaking the bank.
2024年8月05日 19:19
I really appreciate this post! I've been searching everywhere for this information and finally found it on Google.