This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
field.String("id"). | |
GoType(ulid.ID("")). | |
DefaultFunc(func() ulid.ID { | |
return ulid.MustNew(globalid.New().User.Prefix) | |
}), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package globalid | |
import ( | |
"fmt" | |
"golang-clean-architecture-ent-gqlgen/ent/todo" | |
"golang-clean-architecture-ent-gqlgen/ent/user" | |
"log" | |
"reflect" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (r *queryResolver) Node(ctx context.Context, id ulid.ID) (ent.Noder, error) { | |
panic(fmt.Errorf("not implemented")) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
models: | |
ID: | |
model: | |
- golang-clean-architecture-ent-gqlgen/pkg/entity/model.ID | |
Node: | |
model: | |
- golang-clean-architecture-ent-gqlgen/pkg/entity/model.Node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package model | |
import "golang-clean-architecture-ent-gqlgen/ent" | |
// Node wraps the basic Node method. | |
type Node = ent.Noder |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type User implements Node { | |
id: ID! | |
name: String! | |
age: Int! | |
todos: [Todo!]! | |
createdAt: String! | |
updatedAt: String! | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Node { | |
id: ID! | |
} | |
type Query { | |
node(id: ID!): Node | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (r *userRepository) Get(ctx context.Context, id *model.ID) (*model.User, error) { | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type User interface { | |
Get(ctx context.Context, id *model.ID) (*model.User, error) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type User interface { | |
Get(ctx context.Context, id *model.ID) (*model.User, error) | |
} | |
... | |
func (u *user) Get(ctx context.Context, id *model.ID) (*model.User, error) { | |
return u.userRepository.Get(ctx, id) | |
} |