Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more helper methods for session pool #311

Closed
haoxins opened this issue Jan 31, 2024 · 6 comments
Closed

Add more helper methods for session pool #311

haoxins opened this issue Jan 31, 2024 · 6 comments
Labels
type/enhancement Type: make the code neat or more efficient

Comments

@haoxins
Copy link
Collaborator

haoxins commented Jan 31, 2024

I want to add some helper methods for some common scenarios.

The method and struct should be:

type Tag struct {
  Field   string `nebula:"Field"`
  Type    string `nebula:"Type"`
  Null    string `nebula:"Null"`
  Default string `nebula:"Default"`
  Comment string `nebula:"Comment"`
}

type Edge struct {
  Field   string `nebula:"Field"`
  Type    string `nebula:"Type"`
  Null    string `nebula:"Null"`
  Default string `nebula:"Default"`
  Comment string `nebula:"Comment"`
}
type TagSchema struct {
	Name   string
	Fields []TagField
}

type TagField struct {
	Field string
	Type  string
	Null  bool
}

type EdgeSchema struct {
	Name   string
	Fields []EdgeField
}

type EdgeField struct {
	Field string
	Type  string
	Null  bool
}
func (pool *SessionPool) ShowTagNames() ([]string, error) {
  ...
}

func (pool *SessionPool) CreateTag(tag TagSchema) error {
  ...
}

func (pool *SessionPool) DescTag(tagName string) ([]Tag, error) {
  ...
}

func (pool *SessionPool) ShowEdgeNames() ([]string, error) {
  ...
}

func (pool *SessionPool) CreateEdge(edge EdgeSchema) error {
  ...
}

func (pool *SessionPool) DescEdge(edgeName string) ([]schema.Edge, error) {
  ...
}

cc @Nicole00 @wey-gu

@Nicole00
Copy link
Contributor

Nicole00 commented Feb 1, 2024

great idea!
Look forward to your pr!
ps: maybe the EdgeSchema and TagSchema can be the same. and TagField and EdgeField can be the same.

@haoxins
Copy link
Collaborator Author

haoxins commented Feb 1, 2024

ps: maybe the EdgeSchema and TagSchema can be the same. and TagField and EdgeField can be the same.

YES!!!

but I can't find a good name for these, any good idea?

I use EdgeOrTagSchema in my project, but it's so ugly.

@QingZ11 QingZ11 added the type/enhancement Type: make the code neat or more efficient label Feb 1, 2024
@Nicole00
Copy link
Contributor

Nicole00 commented Feb 1, 2024

How about LabelSchema and LabelField? the tag and the edge can be represented by label.

@haoxins
Copy link
Collaborator Author

haoxins commented Feb 1, 2024

@Nicole00 #312

@haoxins
Copy link
Collaborator Author

haoxins commented Feb 2, 2024

closed by #312

@haoxins haoxins closed this as completed Feb 2, 2024
@wey-gu
Copy link

wey-gu commented Feb 2, 2024

We need this in all SDKs Orz....🫡

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Type: make the code neat or more efficient
Projects
None yet
Development

No branches or pull requests

4 participants