Created
April 7, 2019 05:57
-
-
Save toorosan/b69fee41c26521b676c046e716b9089d to your computer and use it in GitHub Desktop.
Revisions
-
toorosan created this gist
Apr 7, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ // Chained functions. type Chained struct { someUpdatedValue string } // ModifyFunction1 makes concatenation of someUpdatedValue and s, divided by "+" func (c Chained) ModifyFunction1(s string) Chained { return Chained{someUpdatedValue: c.someUpdatedValue + "+" + s} } // ModifyFunction2 makes concatenation of someUpdatedValue and s, divided by "-" func (c Chained) ModifyFunction2(s string) Chained { return Chained{someUpdatedValue: c.someUpdatedValue + "-" +s} } // String makes returns someUpdatedValue, helper for printing. func (c Chained) String() string { return c.someUpdatedValue } // ChainedExample provides example of usage for chained functions. func ChainedExample(initialValue string) Chained { return Chained{initialValue}. ModifyFunction1("ModifyFunction1"). ModifyFunction2("ModifyFunction2") }