Skip to content

Commit 986a982

Browse files
committed
code refactor
1 parent c395c3e commit 986a982

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

gs/internal/gs/gs.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
// Package gs provides all the concepts required for go-spring implementation.
17+
// Package gs provides all the concepts required for Go-Spring implementation.
1818
package gs
1919

2020
import (
@@ -25,12 +25,12 @@ import (
2525
"github.com/go-spring/spring-core/conf"
2626
)
2727

28-
// BeanInitFunc defines the prototype for initialization functions,
29-
// e.g., `func(bean)` or `func(bean) error`.
28+
// BeanInitFunc defines the prototype for initialization functions.
29+
// For example: `func(bean)` or `func(bean) error`.
3030
type BeanInitFunc = interface{}
3131

32-
// BeanDestroyFunc defines the prototype for destroy functions,
33-
// e.g., `func(bean)` or `func(bean) error`.
32+
// BeanDestroyFunc defines the prototype for destroy functions.
33+
// For example: `func(bean)` or `func(bean) error`.
3434
type BeanDestroyFunc = interface{}
3535

3636
// BeanInitInterface defines an interface for bean initialization.
@@ -89,7 +89,7 @@ type Condition interface {
8989
Matches(ctx CondContext) (bool, error)
9090
}
9191

92-
// CondBean represents a bean with an ID, Name, TypeName, and Type.
92+
// CondBean represents a bean with Name and Type.
9393
type CondBean interface {
9494
Name() string
9595
Type() reflect.Type
@@ -132,6 +132,7 @@ type Callable interface {
132132

133133
/*********************************** conf ************************************/
134134

135+
// Properties represents read-only configuration properties.
135136
type Properties = conf.ReadOnlyProperties
136137

137138
// Refreshable represents an object that can be dynamically refreshed.
@@ -144,8 +145,8 @@ type Refreshable interface {
144145

145146
// ConfigurationParam holds configuration parameters for bean setup.
146147
type ConfigurationParam struct {
147-
Includes []string // Methods to include
148-
Excludes []string // Methods to exclude
148+
Includes []string // List of methods to include
149+
Excludes []string // List of methods to exclude
149150
}
150151

151152
// BeanRegistration provides methods to configure and register bean metadata.

gs/internal/gs_cond/cond.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ func (c *onFunc) String() string {
5757
/******************************* OnProperty **********************************/
5858

5959
// OnPropertyInterface defines the methods for evaluating a condition based on a property.
60+
// This interface provides flexibility for matching missing properties and checking their values.
6061
type OnPropertyInterface interface {
6162
gs.Condition
6263
MatchIfMissing() OnPropertyInterface
@@ -268,26 +269,26 @@ func (c *onExpression) String() string {
268269

269270
/********************************** Not ***************************************/
270271

271-
// not is a condition that negates another condition. It returns true if the wrapped
272+
// onNot is a condition that negates another condition. It returns true if the wrapped
272273
// condition evaluates to false, and false if the wrapped condition evaluates to true.
273-
type not struct {
274+
type onNot struct {
274275
c gs.Condition // The condition to negate.
275276
}
276277

277278
// Not creates a condition that inverts the result of the provided condition.
278279
func Not(c gs.Condition) gs.Condition {
279-
return &not{c: c}
280+
return &onNot{c: c}
280281
}
281282

282-
func (c *not) Matches(ctx gs.CondContext) (bool, error) {
283+
func (c *onNot) Matches(ctx gs.CondContext) (bool, error) {
283284
ok, err := c.c.Matches(ctx)
284285
if err != nil {
285286
return false, errutil.WrapError(err, "condition matches error: %s", c)
286287
}
287288
return !ok, nil
288289
}
289290

290-
func (c *not) String() string {
291+
func (c *onNot) String() string {
291292
return fmt.Sprintf("Not(%s)", c.c)
292293
}
293294

0 commit comments

Comments
 (0)