Skip to content

Commit

Permalink
gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
erictg committed Dec 5, 2019
1 parent e58c8b8 commit 3d63001
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion cmd/gogmcli/gen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,4 +274,4 @@ func parseDirection(rel *relConf, rels []*relConf, tplRel *tplRelConf, isSpecial
}

return nil
}
}
6 changes: 3 additions & 3 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type Config struct {
// Host is the neo4j host
Host string `yaml:"host" json:"host"`
// Port is the neo4j port
Port int `yaml:"port" json:"port"`
Port int `yaml:"port" json:"port"`

// IsCluster specifies whether GoGM is connecting to a casual cluster or not
IsCluster bool `yaml:"is_cluster" json:"is_cluster"`
Expand Down Expand Up @@ -92,11 +92,11 @@ type IndexStrategy int

const (
// Assert Index ensures that all indices are set and sets them if they are not there
ASSERT_INDEX IndexStrategy = 0
ASSERT_INDEX IndexStrategy = 0
// Validate Index ensures that all indices are set
VALIDATE_INDEX IndexStrategy = 1
// Ignore Index skips the index step of setup
IGNORE_INDEX IndexStrategy = 2
IGNORE_INDEX IndexStrategy = 2
)

//holds mapped types
Expand Down
58 changes: 29 additions & 29 deletions decorator.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,73 +38,73 @@ var timeType = reflect.TypeOf(time.Time{})
const (
// specifies the name in neo4j
//requires assignment (if specified)
paramNameField = "name"
paramNameField = "name"

// specifies the name of the relationship
//requires assignment (if edge field)
relationshipNameField = "relationship"

//specifies direction, can only be (incoming|outgoing|both|none)
//requires assignment (if edge field)
directionField = "direction"
directionField = "direction"

//specifies if the field contains time representation
timeField = "time"
timeField = "time"

//specifies if the field is to be indexed
indexField = "index"
indexField = "index"

//specifies if the field is unique
uniqueField = "unique"
uniqueField = "unique"

//specifies is the field is a primary key
primaryKeyField = "pk"
primaryKeyField = "pk"

//specifies if the field is map of type `map[string]interface{}`
propertiesField = "properties"
propertiesField = "properties"

//specifies if the field is to be ignored
ignoreField = "-"
ignoreField = "-"

//specifies deliminator between GoGM tags
deliminator = ";"
deliminator = ";"

//assignment operator for GoGM tags
assignmentOperator = "="
assignmentOperator = "="
)

//decorator config defines configuration of GoGM field
type decoratorConfig struct {
// holds reflect type for the field
Type reflect.Type `json:"-"`
Type reflect.Type `json:"-"`
// holds the name of the field for neo4j
Name string `json:"name"`
Name string `json:"name"`
// holds the name of the field in the struct
FieldName string `json:"field_name"`
FieldName string `json:"field_name"`
// holds the name of the relationship
Relationship string `json:"relationship"`
Relationship string `json:"relationship"`
// holds the direction
Direction dsl.Direction `json:"direction"`
Direction dsl.Direction `json:"direction"`
// specifies if field is to be unique
Unique bool `json:"unique"`
Unique bool `json:"unique"`
// specifies if field is to be indexed
Index bool `json:"index"`
Index bool `json:"index"`
// specifies if field represents many relationship
ManyRelationship bool `json:"many_relationship"`
ManyRelationship bool `json:"many_relationship"`
// uses edge specifies if the edge is a special node
UsesEdgeNode bool `json:"uses_edge_node"`
UsesEdgeNode bool `json:"uses_edge_node"`
// specifies whether the field is the nodes primary key
PrimaryKey bool `json:"primary_key"`
PrimaryKey bool `json:"primary_key"`
// specify if the field holds properties
Properties bool `json:"properties"`
Properties bool `json:"properties"`
// specifies if the field contains time value
IsTime bool `json:"is_time"`
IsTime bool `json:"is_time"`
// specifies if the field contains a typedef of another type
IsTypeDef bool `json:"is_type_def"`
IsTypeDef bool `json:"is_type_def"`
// holds the reflect type of the root type if typedefed
TypedefActual reflect.Type `json:"-"`
TypedefActual reflect.Type `json:"-"`
// specifies whether to ignore the field
Ignore bool `json:"ignore"`
Ignore bool `json:"ignore"`
}

// Equals checks equality of decorator configs
Expand All @@ -123,13 +123,13 @@ func (d *decoratorConfig) Equals(comp *decoratorConfig) bool {
type structDecoratorConfig struct {
// Holds fields -> their configurations
// field name : decorator configuration
Fields map[string]decoratorConfig `json:"fields"`
Fields map[string]decoratorConfig `json:"fields"`
// holds label for the node, maps to struct name
Label string `json:"label"`
Label string `json:"label"`
// specifies if the node is a vertex or an edge (if true, its a vertex)
IsVertex bool `json:"is_vertex"`
IsVertex bool `json:"is_vertex"`
// holds the reflect type of the struct
Type reflect.Type `json:"-"`
Type reflect.Type `json:"-"`
}

// Equals checks equality of structDecoratorConfigs
Expand Down
6 changes: 3 additions & 3 deletions defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const loadMapField = "LoadMap"
// BaseNode contains fields that ALL GoGM nodes are required to have
type BaseNode struct {
// Id is the GraphId that neo4j uses internally
Id int64 `json:"-" gogm:"name=id"`
Id int64 `json:"-" gogm:"name=id"`
// UUID is the unique identifier GoGM uses as a primary key
UUID string `json:"uuid" gogm:"pk;name=uuid"`

Expand All @@ -42,13 +42,13 @@ const (
Single RelationType = 0

// Side of relationship can point to 0+ other nodes
Multi RelationType = 1
Multi RelationType = 1
)

// RelationConfig specifies how relationships are loaded
type RelationConfig struct {
// stores graph ids
Ids []int64 `json:"-" gomg:"-"`
Ids []int64 `json:"-" gomg:"-"`
// specifies relationship type
RelationType RelationType `json:"-" gomg:"-"`
}
8 changes: 4 additions & 4 deletions pagination.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ import "errors"
// pagination configuration
type Pagination struct {
// specifies which page number to load
PageNumber int
PageNumber int
// limits how many records per page
LimitPerPage int
LimitPerPage int
// specifies variable to order by
OrderByVarName string
// specifies field to order by on
OrderByField string
OrderByField string
// specifies whether orderby is desc or asc
OrderByDesc bool
OrderByDesc bool
}

func (p *Pagination) Validate() error {
Expand Down
10 changes: 5 additions & 5 deletions save.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@ type nodeCreateConf struct {
// params to save
Params map[string]interface{}
// type to save by
Type reflect.Type
Type reflect.Type
// whether the node is new or not
IsNew bool
IsNew bool
}

// relCreateConf holds configuration for nodes to link together
type relCreateConf struct {
// start uuid of relationship
StartNodeUUID string
// end uuid of relationship
EndNodeUUID string
EndNodeUUID string
// any data to store in edge
Params map[string]interface{}
Params map[string]interface{}
// holds direction of the edge
Direction dsl.Direction
Direction dsl.Direction
}

// saves target node and connected node to specified depth
Expand Down

0 comments on commit 3d63001

Please sign in to comment.