Skip to content

Commit

Permalink
update example directory
Browse files Browse the repository at this point in the history
  • Loading branch information
aakash-rajur committed Oct 10, 2023
1 parent b9d38ea commit 947b92d
Show file tree
Hide file tree
Showing 33 changed files with 610 additions and 533 deletions.
3 changes: 1 addition & 2 deletions example/internal/tmdb_mysql/api/get_actor.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package api
import (
_ "embed"
"fmt"
"strings"

"github.com/aakash-rajur/example/internal/tmdb_mysql/store"
"strings"
)

type GetActorArgs struct {
Expand Down
3 changes: 1 addition & 2 deletions example/internal/tmdb_mysql/api/get_company.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package api
import (
_ "embed"
"fmt"
"strings"

"github.com/aakash-rajur/example/internal/tmdb_mysql/store"
"strings"
)

type GetCompanyArgs struct {
Expand Down
3 changes: 1 addition & 2 deletions example/internal/tmdb_mysql/api/get_crew.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package api
import (
_ "embed"
"fmt"
"strings"

"github.com/aakash-rajur/example/internal/tmdb_mysql/store"
"strings"
)

type GetCrewArgs struct {
Expand Down
3 changes: 1 addition & 2 deletions example/internal/tmdb_mysql/api/get_movie.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package api
import (
_ "embed"
"fmt"
"strings"

"github.com/aakash-rajur/example/internal/tmdb_mysql/store"
"strings"
)

type GetMovieArgs struct {
Expand Down
3 changes: 1 addition & 2 deletions example/internal/tmdb_mysql/api/list_actors.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package api
import (
_ "embed"
"fmt"
"strings"

"github.com/aakash-rajur/example/internal/tmdb_mysql/store"
"strings"
)

type ListActorsArgs struct {
Expand Down
3 changes: 1 addition & 2 deletions example/internal/tmdb_mysql/api/list_companies.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package api
import (
_ "embed"
"fmt"
"strings"

"github.com/aakash-rajur/example/internal/tmdb_mysql/store"
"strings"
)

type ListCompaniesArgs struct {
Expand Down
3 changes: 1 addition & 2 deletions example/internal/tmdb_mysql/api/list_crew.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package api
import (
_ "embed"
"fmt"
"strings"

"github.com/aakash-rajur/example/internal/tmdb_mysql/store"
"strings"
)

type ListCrewArgs struct {
Expand Down
3 changes: 1 addition & 2 deletions example/internal/tmdb_mysql/api/list_hyper_parameters.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package api
import (
_ "embed"
"fmt"
"strings"

"github.com/aakash-rajur/example/internal/tmdb_mysql/store"
"strings"
)

type ListHyperParametersArgs struct {
Expand Down
3 changes: 1 addition & 2 deletions example/internal/tmdb_mysql/api/list_movies.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package api
import (
_ "embed"
"fmt"
"strings"

"github.com/aakash-rajur/example/internal/tmdb_mysql/store"
"strings"
)

type ListMoviesArgs struct {
Expand Down
32 changes: 16 additions & 16 deletions example/internal/tmdb_mysql/models/company.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import (
)

type Company struct {
Id *int64 `db:"id" json:"id"`
Name *string `db:"name" json:"name"`
Id *int64 `db:"id" json:"id"`
}

func (company Company) String() string {
content := strings.Join(
[]string{
fmt.Sprintf("Id: %v", *company.Id),
fmt.Sprintf("Name: %v", *company.Name),
fmt.Sprintf("Id: %v", *company.Id),
},
", ",
)
Expand Down Expand Up @@ -55,36 +55,36 @@ func (_ Company) DeleteQuery() string {
// language=mysql
var companyInsertSql = `
INSERT INTO app.companies(
id,
name
name,
id
)
VALUES (
:id,
:name
:name,
:id
)
RETURNING
id,
name;
name,
id;
`

// language=mysql
var companyUpdateSql = `
UPDATE app.companies
SET
id = :id,
name = :name
name = :name,
id = :id
WHERE TRUE
AND id = :id
RETURNING
id,
name;
name,
id;
`

// language=mysql
var companyFindSql = `
SELECT
id,
name
name,
id
FROM app.companies
WHERE TRUE
AND (:id IS NULL or id = :id)
Expand All @@ -94,8 +94,8 @@ LIMIT 1;
// language=mysql
var companyFindAllSql = `
SELECT
id,
name
name,
id
FROM app.companies
WHERE TRUE
AND (:id IS NULL or id = :id);
Expand Down
24 changes: 12 additions & 12 deletions example/internal/tmdb_mysql/models/crew.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import (
)

type Crew struct {
Id *int64 `db:"id" json:"id"`
Name *string `db:"name" json:"name"`
Id *int64 `db:"id" json:"id"`
}

func (crew Crew) String() string {
content := strings.Join(
[]string{
fmt.Sprintf("Id: %v", *crew.Id),
fmt.Sprintf("Name: %v", *crew.Name),
fmt.Sprintf("Id: %v", *crew.Id),
},
", ",
)
Expand Down Expand Up @@ -61,28 +61,28 @@ VALUES (
:name
)
RETURNING
id,
name;
name,
id;
`

// language=mysql
var crewUpdateSql = `
UPDATE app.crew
SET
id = :id,
name = :name
name = :name,
id = :id
WHERE TRUE
AND id = :id
RETURNING
id,
name;
name,
id;
`

// language=mysql
var crewFindSql = `
SELECT
id,
name
name,
id
FROM app.crew
WHERE TRUE
AND (:id IS NULL or id = :id)
Expand All @@ -92,8 +92,8 @@ LIMIT 1;
// language=mysql
var crewFindAllSql = `
SELECT
id,
name
name,
id
FROM app.crew
WHERE TRUE
AND (:id IS NULL or id = :id);
Expand Down
46 changes: 23 additions & 23 deletions example/internal/tmdb_mysql/models/hyper_parameter.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import (

type HyperParameter struct {
FriendlyName *string `db:"friendly_name" json:"friendly_name"`
Value *string `db:"value" json:"value"`
Type *string `db:"type" json:"type"`
Value *string `db:"value" json:"value"`
}

func (hyperParameter HyperParameter) String() string {
content := strings.Join(
[]string{
fmt.Sprintf("FriendlyName: %v", *hyperParameter.FriendlyName),
fmt.Sprintf("Value: %v", *hyperParameter.Value),
fmt.Sprintf("Type: %v", *hyperParameter.Type),
fmt.Sprintf("Value: %v", *hyperParameter.Value),
},
", ",
)
Expand All @@ -30,8 +30,8 @@ func (_ HyperParameter) TableName() string {

func (_ HyperParameter) PrimaryKey() []string {
return []string{
"value",
"type",
"value",
}
}

Expand Down Expand Up @@ -59,65 +59,65 @@ func (_ HyperParameter) DeleteQuery() string {
var hyperParameterInsertSql = `
INSERT INTO app.hyper_parameters(
friendly_name,
value,
type
type,
value
)
VALUES (
:friendly_name,
:value,
:type
:type,
:value
)
RETURNING
friendly_name,
value,
type;
type,
value;
`

// language=mysql
var hyperParameterUpdateSql = `
UPDATE app.hyper_parameters
SET
friendly_name = :friendly_name,
value = :value,
type = :type
type = :type,
value = :value
WHERE TRUE
AND value = :value
AND type = :type
AND value = :value
RETURNING
friendly_name,
value,
type;
type,
value;
`

// language=mysql
var hyperParameterFindSql = `
SELECT
friendly_name,
value,
type
type,
value
FROM app.hyper_parameters
WHERE TRUE
AND (:value IS NULL or value = :value)
AND (:type IS NULL or type = :type)
AND (:value IS NULL or value = :value)
LIMIT 1;
`

// language=mysql
var hyperParameterFindAllSql = `
SELECT
friendly_name,
value,
type
type,
value
FROM app.hyper_parameters
WHERE TRUE
AND (:value IS NULL or value = :value)
AND (:type IS NULL or type = :type);
AND (:type IS NULL or type = :type)
AND (:value IS NULL or value = :value);
`

// language=mysql
var hyperParameterDeleteSql = `
DELETE FROM app.hyper_parameters
WHERE TRUE
AND value = :value
AND type = :type;
AND type = :type
AND value = :value;
`
Loading

0 comments on commit 947b92d

Please sign in to comment.