Skip to content
This repository has been archived by the owner on Jan 14, 2025. It is now read-only.

Commit

Permalink
docs: Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ginokent committed Jun 2, 2024
1 parent 4e3dfa6 commit d756b6e
Showing 1 changed file with 51 additions and 7 deletions.
58 changes: 51 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type Group struct {
EOF

$ # == 2. generate file ================================
$ arcgen --src /tmp/sample.go
$ arcgen --slice-type-suffix Slice --src /tmp/sample.go
INFO: 2023/11/12 03:56:59 arcgen.go:33: source: /tmp/sample.go

$ # == 3. Check generated file ================================
Expand All @@ -54,6 +54,12 @@ func (s *User) TableName() string {
return "Users"
}

type UserSlice []*User

func (s UserSlice) TableName() string {
return "Users"
}

func (s *User) ColumnNames() []string {
return []string{"Id", "Name", "Age"}
}
Expand All @@ -70,6 +76,22 @@ func (s *User) ColumnName_Age() string {
return "Age"
}

func (s UserSlice) ColumnNames() []string {
return []string{"Id", "Name", "Age"}
}

func (s UserSlice) ColumnName_ID() string {
return "Id"
}

func (s UserSlice) ColumnName_Name() string {
return "Name"
}

func (s UserSlice) ColumnName_Age() string {
return "Age"
}

func (s *Group) ColumnNames() []string {
return []string{"Id", "Name", "Description"}
}
Expand All @@ -85,26 +107,48 @@ func (s *Group) ColumnName_Name() string {
func (s *Group) ColumnName_Description() string {
return "Description"
}

func (s GroupSlice) ColumnNames() []string {
return []string{"Id", "Name", "Description"}
}

func (s GroupSlice) ColumnName_ID() string {
return "Id"
}

func (s GroupSlice) ColumnName_Name() string {
return "Name"
}

func (s GroupSlice) ColumnName_Description() string {
return "Description"
}
```

## Installation

### pre-built binary

```bash
VERSION=v0.0.8
LATEST_VERSION=$(curl -ISs https://github.com/kunitsucom/ddlctl/releases/latest | tr -d '\r' | awk -F/ '/location:/{print $NF}')
OS=$(uname | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
URL="https://github.com/kunitsucom/ddlctl/releases/download/${LATEST_VERSION}/ddlctl_${LATEST_VERSION}_${OS}_${ARCH}.zip"

# Check URL
echo "${URL}"

# download
curl -fLROSs https://github.com/kunitsucom/arcgen/releases/download/${VERSION}/arcgen_${VERSION}_darwin_arm64.zip
# Download
curl -fLROSs "${URL}"

# unzip
unzip -j arcgen_${VERSION}_darwin_arm64.zip '*/arcgen'
# Unzip
unzip -j arcgen_${LATEST_VERSION}_${OS}_${ARCH}.zip '*/arcgen'
```

### go install

```bash
go install github.com/kunitsucom/arcgen/cmd/arcgen@v0.0.8
go install github.com/kunitsucom/arcgen/cmd/arcgen@latest
```

## Usage
Expand Down

0 comments on commit d756b6e

Please sign in to comment.