<commit_before>Reflections
===========

Package reflections provides high level abstractions above the golang reflect library.

Reflect library is very low-level and can be quite complex when it comes to do simple things like accessing a structure field value, a field tag...

The purpose of reflections package is to make developers life easier when it comes to introspect structures at runtime.
Its API is inspired from python language (getattr, setattr, hasattr...) and provides a simplified access to structure fields and tags.

*Reflections is an open source library under the MIT license. Any hackers are welcome to supply ideas, features requests, patches, pull requests and so on: see [Contribute]()*

#### Documentation

Documentation is available at http://godoc.org/github.com/oleiade/reflections


## Installation

#### Into the gopath

```
    go get gopkg.in/oleiade/reflections.v1
```

#### Import it in your code

```go
    import (
        "gopkg.in/oleiade/reflections.v1"
    )
```

## Usage

#### Accessing structure fields

##### GetField

*GetField* returns the content of a structure field. It can be very usefull when
you'd wanna iterate over a struct specific fields values for example. You can whether
provide *GetField* a structure or a pointer to structure as first argument.

```go
    s := MyStruct {
        FirstField: "first value",
        SecondField: 2,
        ThirdField: "third value",
    }

    fieldsToExtract := []string{"FirstField", "ThirdField"}

    for _, fieldName := range fieldsToExtract {
        value, err := reflections.GetField(s, fieldName)
        DoWhatEverWithThatValue(value)
    }<commit_msg>Remove unnecessary instructions from README<commit_after>Reflections
===========

Package reflections provides high level abstractions above the golang reflect library.

Reflect library is very low-level and can be quite complex when it comes to do simple things like accessing a structure field value, a field tag...

The purpose of reflections package is to make developers life easier when it comes to introspect structures at runtime.
Its API is inspired from python language (getattr, setattr, hasattr...) and provides a simplified access to structure fields and tags.

*Reflections is an open source library under the MIT license. Any hackers are welcome to supply ideas, features requests, patches, pull requests and so on: see [Contribute]()*

#### Documentation

Documentation is available at http://godoc.org/github.com/oleiade/reflections

## Usage

#### Accessing structure fields

##### GetField

*GetField* returns the content of a structure field. It can be very usefull when
you'd wanna iterate over a struct specific fields values for example. You can whether
provide *GetField* a structure or a pointer to structure as first argument.

```go
    s := MyStruct {
        FirstField: "first value",
        SecondField: 2,
        ThirdField: "third value",
    }

    fieldsToExtract := []string{"FirstField", "ThirdField"}

    for _, fieldName := range fieldsToExtract {
        value, err := reflections.GetField(s, fieldName)
        DoWhatEverWithThatValue(value)
    }
{'fraction_non_alphanumeric': 0.08267090620031796, 'fraction_numerical': 0.0012718600953895071, 'mean_word_length': 3.9621451104100944, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '432934', 'n_tokens_mistral': 831, 'n_tokens_neox': 790, 'n_words': 377}