All Projects → OddCN → go-builder-generator-idea-plugin

OddCN / go-builder-generator-idea-plugin

Licence: MIT license
IntelliJ IDEA / GoLand golang plugin for generating Builder pattern code of golang struct.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to go-builder-generator-idea-plugin

intellij-treeInfotip
IDEA项目结构树中的节点添加显示自定义备注文本IDEA DirectoryNode adds custom text for display
Stars: ✭ 48 (+128.57%)
Mutual labels:  idea-plugin, intellij-idea
idea-return-highlighter
Highlight return keywords.
Stars: ✭ 24 (+14.29%)
Mutual labels:  idea-plugin, intellij-idea
SideMirror
An Android Studio plugin to mirror your android devices with scrcpy directly from Android Studio.
Stars: ✭ 49 (+133.33%)
Mutual labels:  intellij-idea, intellijidea-plugin
reasonml-idea-plugin
ReasonML Language Plugin for IDEA
Stars: ✭ 320 (+1423.81%)
Mutual labels:  idea-plugin
csharp-design-patterns-for-humans
Design Patterns for Humans™ - An ultra-simplified explanation - C# Examples
Stars: ✭ 1,086 (+5071.43%)
Mutual labels:  builder-pattern
SwiftBuilder
SwiftBuilder is a fast way to assign new value to the property of the object.
Stars: ✭ 26 (+23.81%)
Mutual labels:  builder-pattern
jakartaee8-starter-boilerplate
A boilerplate project for starting a Jakarta EE 8 application in seconds
Stars: ✭ 55 (+161.9%)
Mutual labels:  intellij-idea
flexiblesearchbuilder
Flexible search query builder is SAP Hybris Commerce extension (released as a library) that provides developer-friendly way to build flexible search queries. The aim of this extension is to write().flexibleSearchQueries().easily() in compile-time safe manner without a need to remember the syntax.
Stars: ✭ 15 (-28.57%)
Mutual labels:  builder-pattern
RedsoftYapiUpload
一个快速生成接口文档的IntelliJ IDEA的Yapi上传小插件,如果给你带来了方便,请给个Star 谢谢
Stars: ✭ 51 (+142.86%)
Mutual labels:  idea-plugin
intelliroutes
Support for Play Routes in IntelliJ IDEA
Stars: ✭ 21 (+0%)
Mutual labels:  idea-plugin
gradle-dependencies-plugins-helper-plugin
This is an IntelliJ IDEA plugin for searching dependencies/plugins from JCentral/GradlePlugins inside Gradle projects.
Stars: ✭ 33 (+57.14%)
Mutual labels:  intellij-idea
java-builder-pattern-tricks
Tricks to use with the java builder pattern
Stars: ✭ 39 (+85.71%)
Mutual labels:  builder-pattern
StopCoding
Idea防沉迷插件,关爱程序员健康。设置每工作多少分钟,强制休息。Idea anti addiction plug-in, care for the health of programmers. Set the number of minutes per work and force the rest.
Stars: ✭ 147 (+600%)
Mutual labels:  idea-plugin
soar-jetbrains-plugin
Plugin of https://github.com/XiaoMi/soar for JetBrains IDE which for SQL optimize and rewrite. SQL 优化工具 SOAR 的 JetBrains IDE 插件
Stars: ✭ 20 (-4.76%)
Mutual labels:  idea-plugin
go-orm-code-helper
🔥🔥🔥go-orm-code-helper is a goland plugin, it aims to make gorm code getting more simple
Stars: ✭ 22 (+4.76%)
Mutual labels:  goland
NutzCodeInsight
Intellij idea plugin for Nutz Web Framwork
Stars: ✭ 35 (+66.67%)
Mutual labels:  idea-plugin
csharp-design-patterns-for-humans-examples
Complete C# Examples Refereed in csharp-design-patterns-for-humans
Stars: ✭ 50 (+138.1%)
Mutual labels:  builder-pattern
ReactPropTypes-Plugin
A Jetbrains Plugin for react PropTypes
Stars: ✭ 62 (+195.24%)
Mutual labels:  idea-plugin
dsl-api-generator
Generates binary compatible and Java interoperable DSL boilerplate code
Stars: ✭ 25 (+19.05%)
Mutual labels:  idea-plugin
uuid-generator-plugin
An IntelliJ Idea plugin to generate UUID (Universally Unique Identifier), ULID (Universally Unique Lexicographically Sortable Identifier) and CUID (Collision Resistant Unique Identifier)
Stars: ✭ 30 (+42.86%)
Mutual labels:  idea-plugin

GoBuilderGenerator

IntelliJ IDEA / GoLand plugin for generating Builder pattern code of Go struct from selected struct code.

How to install

  • in IntelliJ IDEA / GoLand : go to Settings/Preferences → Plugins → Browse repositories and search for Go Builder Generator

or

  • download it and install via Settings/Preferences → Plugins → Install plugin from disk

How to use it

  1. Select the struct code

  2. Shortcut: (Alt + B) or Menu: [Code] → [Generate Go Builder Pattern Code]

demo_gif

Demo

If we have a struct like this:

type CreateDisk struct {
    RegionID     string //required for creating CreateDisk struct
    ZoneID       string //required for creating CreateDisk struct
    DiskName     string
    Description  string
    Encrypted    bool
    DiskCategory string
    Size         int
    SnapshotID   string
    ClientToken  string
}

After generated, we got

  • type CreateDiskBuilder struct for storing *CreateDisk
  • func NewCreateDiskBuilder() for creating a builder
  • functions for receiving parameters
  • func Build() for checking and building

// CreateDisk builder pattern code
type CreateDiskBuilder struct {
    createDisk *CreateDisk
}
func NewCreateDiskBuilder() *CreateDiskBuilder {
    createDisk := &CreateDisk{}
    b := &CreateDiskBuilder{createDisk: createDisk}
    return b
}
func (b *CreateDiskBuilder) RegionID(regionID string) *CreateDiskBuilder {
    b.createDisk.RegionID = regionID
    return b
}

func (b *CreateDiskBuilder) ZoneID(zoneID string) *CreateDiskBuilder {
    b.createDisk.ZoneID = zoneID
    return b
}

.
.
.

func (b *CreateDiskBuilder) ClientToken(clientToken string) *CreateDiskBuilder {
    b.createDisk.ClientToken = clientToken
    return b
}
func (b *CreateDiskBuilder) Build() (*CreateDisk, error) {
    // May miss required parameters
    return b.createDisk, nil
}

When we use it

createDisk, err := NewCreateDiskBuilder().
    DiskName("test name").
    Description("desc").
    Size(20).
    SnapshotID("").
    Build()
if err != nil {
    // May miss required parameters
    return
}
// Do something with createDisk
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].